Reputation: 1064
I tried to deploy my Node.js app on Google Cloud using a flexible App Engine. On my local machine the project runs without errors, but on the cloud, it produces strange errors
Like the one, where I need to require
the URL
class, otherwise it's undefined, while on my machine it works without the require
. Another one I still couldn't figure out is when I Proxy
the global Promise
object, it comes back as a function, but mongoose fails to load, because global.Promise
is not a function.
I'm on the latest Node LTS version and using Yarn, so the dependencies definitely have the correct version. Is there a different Node.js runtime I'm not aware of? Or is it an environment setting I can set?
Edit: These errors happen during build (maybe that has something to do with it?)
Upvotes: 0
Views: 301
Reputation: 1064
So it turns out the Google Cloud Builder doesn't use the latest node version by default. I needed to specify it in the cloudbuilder.yaml
, e.g.:
steps:
- name: "gcr.io/cloud-builders/yarn:node-10.10.0"
args: ["install", "--production"]
Upvotes: 1