Meteor 1.10.1 with Google Cloud Storage results in "worker_threads" build warning

Hello guys.

I hope someone would be able to assist.

I have Meteor 1.10.1 installed and running smoothly.

I wanted to connect from my server side code to my firebase storage with the help of @google-cloud/storage package. It was fairly simple and I got it working as expected.
However, for some reason right after installing this package I get this build warning every time:

Unable to resolve some modules:

  "worker_threads" in /.../node_modules/write-file-atomic/index.js (web.browser)
                                              
If you notice problems related to these missing modules, consider running:
                                              
  meteor npm install --save meteor-node-stubs

Unfortunately running meteor npm install --save meteor-node-stubs as suggested in the console doesn’t solve this issue.

If you want to reproduce this warning just install @google-cloud/storage and run meteor.

After investigating a little further I found out this closed issue.
Apparently this warning should appear only when using node version <= v11.7.0 - but Meteor v1.10.1 uses node v12.16.1 so I don’t understand what’s going on here :thinking:.

That’s why I thought it makes more sense to ask here rather than open issue for write-file-atomic package, I suspect it might be related to the meteor setup.

I have tried reinstalling all my packages, running meteor reset, etc.
Still getting the warning, even though it seems harmless so far I don’t feel comfortable to push these changes to production.

Any assistance is much appreciated :pray:

UPDATE1: I tested it thoroughly and found out that this missing module did break compatibility of some apple mobile devices, rendering blank screens.

UPDATE 2: apperantly there are two ways to connect to google cloud storage, one of them is the one I mentioned in this post, the other one is using firebase-admin library.

UPDATE 3: I have opened an issue in meteor repo. Link here.
I tested this option too and ended up with the a quite similar build output:

Unable to resolve some modules:

"worker_threads" in /Users/asafratzon/projects/sunbird/node_modules/write-file-atomic/index.js (web.browser.legacy)
"http2" in /Users/asafratzon/projects/sunbird/node_modules/@grpc/grpc-js/build/src/call-stream.js (web.browser.legacy)
                                            
If you notice problems related to these missing modules, consider running:
                                              
  meteor npm install --save meteor-node-stubs 

I’m wondering - am I the only one who faces this? Am I the only one that uses google cloud storage (i.e. firebase) with Meteor? I’d be surprised.

Hope I’m wrong and there is an easy fix I’m missing.
Cheers and thanks in advance to those who try to help :v:

I am facing the same issue. I installed @google-cloud/storage from npm to use the cloud storage api, and after installing the app crashed with the following message:

Unable to resolve some modules:

  "request" in /E/Development/meteor/progresspics/meteor-app/node_modules/retry-request/index.js (web.browser)
  "fast-crc32c" in /E/Development/meteor/progresspics/meteor-app/node_modules/hash-stream-validation/index.js (web.browser)
  "worker_threads" in /E/Development/meteor/progresspics/meteor-app/node_modules/write-file-atomic/index.js (web.browser)

If you notice problems related to these missing modules, consider running:

  meteor npm install --save request fast-crc32c meteor-node-stubs

I installed the reccomended npm modules, and while the application runs fine, I still get the warning in the console:

Unable to resolve some modules:

  "worker_threads" in /E/Development/meteor/progresspics/meteor-app/node_modules/write-file-atomic/index.js (web.browser.legacy)

If you notice problems related to these missing modules, consider running:

  meteor npm install --save meteor-node-stubs

Haven’t tested on mobile devices with Cordova.

Hi @megaleon.

I now understand better when those build errors occur and how to avoid them.

In my case they occurred only when I used import or require of a module from @google-cloud/storage (or firebase-admin library) in client files. To verify this make sure all usage is in a server file only (e.g. server/main.js) and see if the errors are gone.

I also found a workaround for using it in client files, see the details here.

P.S. I wanted to add [SOLVED] to the thread name but I can’t edit it for some reason. If you are a moderator please update it. 10x.