Context
I have a meteor app that serves http and https.
It’s deployed using mup
I haven’t done any code change for a year now, and everything worked fine last time I checked (a few months ago).
Problem
When I open the https I now have a blank screen. Inspecting the console, I have dozens of “Cannot find module” and it sounds like every atmosphere packages I use in my app are concerned. See below :
My first guess was the letsencrypt certificate, so I checked the logs using mup logs proxy-le and it looks good. I also looked up on sslshopper and it looks valid. On top of that, I can access the website without chrome saying “suspicious website”. All this led me to abandon this lead. IMO It’s not a certificate issue
I checked on the deploy logs to look after any error but couldn’t find any
I tried an old version (more than a year ago) of Google Chrome in order to see if it was browser related, but I still have the issue on the old version. By the way, I have the issue on Firefox as well. So not browser relatred IMO.
Try to check, If that missing Babel path is preset in bundled and deployed package. I don’t know, why the Babel is importing into the frontend (maybe somebody can explain), by me Babel is dev dependency not dependency related to the frontend, maybe there is something wrong.
Did you tried the same with emty Meteor project, if the error is the same to know, if is not issue inside your project?
…yes, I was reading docs and it’s using to eliminate code duplications, but also it adding some polyfils and etc. therefore babel/runtime on frontend is not a mistake.
Thanks for your answer. I tried your suggestion to create a new meteor app and deploy it the same way. To do so, I followed the create app tuto and did 1.1 (install meteor) and 1.2 (meteor create simple-todos-react)
With this, I am on meteor 2.16 and used the same deployment process (using mup) and surprise : still the issue. I checked in the server logs, No problem there.
See below the browser console :
On the server, in the docker running the application : Now using node v14.18.1 (npm v6.14.15)
Since it’s a docker image I do not control, I am not sure if npm install is executed before it starts the app but I would say from what I can see on the docker logs.
But it could be done on another container before, I am not sure exactly of the “mup deploy” process.
Reading the mup documentation, I read that my Docker image “Automatically uses the correct node version for the app’s Meteor version.”
I don’t know enough mup to know where to look at the node compliation version, sorry. From my readings, I assume mup does this accordingly. But I may be wrong !
Running the build Locally… Trying to check your last point, I have issues on this tutorial. I run $ meteor build ../output --architecture os.osx.x86_64 but then after unzipping the app.tar.gz I have an error with node-gyp on my macos, so I Installed it (reference for readers). But still the error is here node-gyp exited with code: 1 so I cannot check that part so far.
maybe you can check Dockerfile of your docker image, if npm install is executed, to be sure. I do not have an experiences with the mup, because I prepared my own docker image and building process I have defined in hithub CI pipeline (but the deployment logic must be very similar). If the docker conrainer is not stopped after meteor error, you can try to use docker exec … to go into the container and check, whats wrong.
…about the docker logs, where npm install is executed, you probably must see the looooot of logs from the packages installation (…or maybe not, because its depends on docker logs configuration).
About the meteor version, probably there will be cat and grep on .meteor/version file to read the version and then I will choose the proper container or execute proper version of node inside container. All this, you can check in dockerfile.
about the building, probably the node-gyp error is because you are using fourseven:scss, there is some procedure to solve it (check my previous discussion threads, somebody writthen the error reason and answer). Because I was veeeery lazy to always solve and avoid the error, I created my own nodsec:scss package which is using dart-sass instead of node-sass, where the scss compilation is little bit more strict but also faster.
…but firstly, you must be sure, when you localy build your package, that package is working without the mistakes, whan you can continue to investigate your automatic deplyment process.
I am going to start with your most prior tips : running locally.
with the todos-react application :
I manage to run locally on my macos the “todos-react” app, using meteor build ../../todos-react-bundle --architecture os.osx.x86_64. After unzipping and following the README it worked when I run the cmd node main.js
I tried to deploy this app using the same “mup” process. The result is that It fails but on both http and https, with similar errors when opening the console on my browser Error: React Refresh runtime should not be included in the production bundle.
and TypeError: Cannot read properties of undefined (reading 'fetch')
It sounds like it’s more related to the deployment process rather than the code itself.
Version : I downgraded meteor from version 2.16 to version 2.12 to make sure it’s not related to a compatibility issue between “mup” and “meteor”. When deploying, it failed again. So it’s not about the meteor version.
with the “real” application :
I tried to deploy the app on a brand new server, using the same mup process and it fails again. So it’s not related to the server itself. but more the mup process I think.
Thanks to your tips, it looks like it’s more related to mup rather than the code itself. Do you agree ? From now on I would like to test another way of deploying the app. Could you share your way of deploying meteor apps for production ready ?
Here are the things that led to this strange issue :
“mup deploy” was pushing a dev version (ie not a bundle), so I had to find out why. It was a parameter of mup.js file that was true so I changed it to app.buildOptions.debug: false
then I had multiple build issues that led to a screen “iron:router, no routes found” : it was actually a matter of removing/upgrading outdated meteor packages. I also need to update the npm packages @babel/runtime and bcrypt.
Now it works like a charm again. To be honest, I am still not sure why it suddenly stopped working, but now the pain is over.
Big shoutout to @paulishca that helped me during hours live coding to debug. He was the one finding the correct path to solve this !