Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Meteor Incompatible with Google Cloud Storage #10984
Getting build warnings + blank screen on old mobile devices when using Meteor + Google Cloud Storage services. I run Meteor v1.10.1 (OSX) but as far as I can tell this bug was around in older Meteor versions as well.
How To Reproduce
There are 2 different ways to access Google Cloud Storage from node.js:
Successful build and access to google cloud storage services.
Having tested both options 1 and 2 thoroughly, I have successfully gained access to google cloud storage services with both libraries. However both generate build warnings.
Here are the final output for each of the setup options:
Option 1 Build Warning (using @google-cloud/storage):
Option 2 Build Warning (using firebase-admin):
Thanks for the detailed and easy-to-follow writeup @asafratzon! However, I'm not having any luck reproducing the warning, and I can successfully log the
Just to be completely sure, what version does
Thanks a lot @benjamn.
I just looked into it again and seems like you're right - printing the variables from server/main.js doesn't reproduce the warnings. You helped me notice that this issue occurs only if some file that is also required by the client is importing something from the Google Cloud Storage init file.
What I did is put the firebase setup in a
I thought it should be possible and easy with Meteor.
When I import the connection ref to this storage.js file (which is also imported by client code), I get the build warning and this warning in the browser:
This is totally understandable of course. But I don't understand why when I wrap the usage with a Meteor.isServer check, I don't get the browser message but I still get the build warnings.
I'm a bit puzzled now, because sometimes the use of the library server-side will be initiated by a client context (e.g. the client removes an item from mongo, I would prefer to manage the item storage removal server-side), and in that case, how could I avoid the warnings?
Even if I only import a general string from the storage init file to a client file I get the warnings (I did this test thinking of using a Meteor method for a server-side storage access).
Is this correct behavior? Any assistance is much appreciated.
UPDATE: Workaround Found!
The workaround I found is to put the connection ref inside a global node.js variable, then I can safely access it from other client files without facing any warnings. So in a server-only file, which is ran on server startup:
Now you can access the connection (
I understand that a global variable in node.js is not a good practice in general, but unfortunately using exports as in
I would appreciate any feedback on this workaround before I close the issue. Many thanks.