Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
GCP journal logs:
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/workspace/node_modules/firebase-admin/lib/default-namespace.js:19:30)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
The logs were not very descriptive but I figured out it was probably due to the node12 engine not being supported anymore ny latest versions.
The fix was to replace the engine version in my generated package.json
"engines": {
"node": "12"
},
"engines": {
"node": "16"
},
As Nx now generates workspaces with node 16^, I figured the generation script at @simondotm\nx-firebase\src\generators\application\files\package.json__template__ could also use a newer version
Hi,
After creating an Nx workspace, and using Create Firebase Application to link with my existing firebase app, I encountered a few errors.
First I fixed with the patch in #https://github.com/simondotm/nx-firebase/issues/44 But then on my function deploys I had the following error:
GCP journal logs:
The logs were not very descriptive but I figured out it was probably due to the node12 engine not being supported anymore ny latest versions.
The fix was to replace the engine version in my generated
package.json
As Nx now generates workspaces with node 16^, I figured the generation script at
@simondotm\nx-firebase\src\generators\application\files\package.json__template__
could also use a newer versionPS: great work thanks for the pluggin!