firebase-tools: 6.7.1
Platform: macOS
Check my project's package.json below:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"tslint": "./node_modules/.bin/tslint --project tsconfig.json",
"eslint": "./node_modules/.bin/eslint '**/*.js'",
"lint": "npm run tslint && npm run eslint",
"build": "npm run lint && tsc",
"serve": "firebase serve --only functions",
"shell": "npm run build && firebase use dev && firebase functions:shell",
"start": "tsc -p . && firebase functions:shell",
"start-http": "tsc -p . && firebase serve --only functions",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log",
"test-staging": "npm run build && firebase use dev && npm run serve",
"deploy-staging": "npm run build && firebase use dev && npm run deploy",
"test-production": "npm run build && firebase use prod && npm run serve",
"deploy-production": "npm run build && firebase use prod && npm run deploy"
},
"main": "lib/index.js",
"dependencies": {
"@google-cloud/storage": "^2.3.3",
"@sendgrid/mail": "^6.3.1",
"archiver": "^3.0.0",
"camelcase": "^5.2.0",
"child-process-promise": "^2.2.1",
"express": "^4.16.3",
"firebase-admin": "^7.3.0",
"firebase-functions": "^2.3.0",
"fs-extra": "^7.0.1",
"glob": "^7.1.3",
"in-app-purchase": "^1.10.8",
"lodash": "^4.17.11",
"mkdirp-promise": "^5.0.1",
"moment": "^2.24.0",
"request": "^2.88.0",
"request-promise": "^4.2.2"
},
"devDependencies": {
"@google-cloud/functions-emulator": "^1.0.0-beta.5",
"@types/request-promise": "^4.1.42",
"eslint": "^4.19.1",
"eslint-plugin-promise": "^3.8.0",
"firebase-bolt": "^0.8.4",
"tslint": "^5.12.0",
"typescript": "^3.4.5"
},
"private": true
}
firebase deploy --only functions
Functions should deploy without any error as they used to be earlier
Functions don't deploy and throw "@google-cloud/storage" error for all functions
âš functions[triggerThumbnailsEducationOnUpdate(us-central1)]: Deployment error.
Function failed on loading user code. Error message: Code in file lib/index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: Error: Failed to import the Cloud Storage client library for Node.js. Make sure to install the "@google-cloud/storage" npm package. Original error: SyntaxError: Unexpected token function
at FirebaseError.Error (native)
at new FirebaseError (/user_code/node_modules/firebase-admin/lib/utils/error.js:42:28)
at new Storage (/user_code/node_modules/firebase-admin/lib/storage/storage.js:60:19)
at /user_code/node_modules/firebase-admin/lib/firebase-app.js:254:20
at FirebaseApp.ensureService_ (/user_code/node_modules/firebase-admin/lib/firebase-app.js:339:23)
at FirebaseApp.storage (/user_code/node_modules/firebase-admin/lib/firebase-app.js:252:21)
at Object.<anonymous> (/user_code/lib/utils/firebase-init.js:24:30)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
It used to deploy fine till yesterday and suddenly my pipelines start failing with deployment errors today. Could you guys help me out?
There are issues with cloud storage currently, which is what is causing your deploy errors. The team is working on it and hopefully these will be resolved soon.
Maybe it's a thing to update your 'status.firebase.google.com' webpage... Or give an insight in when you think this is fixed? @thechenky
Not sure if this is the place to put this, but we are experiencing a similar problem.
Only started failing this morning.
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: /user_code/node_modules/@google-cloud/bigquery/node_modules/gaxios/build/src/index.js:28
async function request(opts) {
^^^^^^^^
SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/node_modules/@google-cloud/bigquery/node_modules/gcp-metadata/build/src/index.js:17:18)
The problem appears to be with BigQuery here rather than Cloud Storage. Not sure if they are linked though?
Reverting to a earlier commit that was working and re-deploying still gives the above error
Now i'm experiencing a new error:
node_modules/gaxios/build/src/index.d.ts(14,66): error TS1005: '>' expected.
node_modules/gaxios/build/src/index.d.ts(14,103): error TS1109: Expression expected.
We're seeing the same today, we haven't changed any packages and finding others on stackoverflow reporting the same https://stackoverflow.com/questions/55866695/read-document-in-firestore-from-firebase-oncall-cloud-function
We're not going down the suggested root of node v8 until we get official confirmation this is fixed first https://github.com/firebase/firebase-tools/issues/853 (I'm sorry, but I don't have time to debug a third-party intermittent environment issue which is also clearly effecting a lot of others in the same way)
This issue has taken down our sales environment and is currently blocking us from deploying production. I don't see anything on cloud storage status. I have no idea how to get our sales-env functions back up. Can you provide a workaround or more details please @thechenky
I also agree with @willemjanvankranenburg , I'm tired of finding known firebase issues in github/stackoverflow/firebase slack community after our CI and deployments fail. We've got firebase statuses streaming into our slack development channel for exactly this reason.
Hi @ahaverty I'm sorry for the frustration this is causing. It is our policy (Cloud and Firebase) to post on the dashboard when >10% of customers are affected, and this was below that threshold.
We've had 45 out of 149 functions throw an error like this on our last deploy.
Workaround/temporary fix: Manually going into google [cloud console functions](https://console.cloud.google.com/functions) -> editing -> save to trigger a redeploy has redeployed the function successfully.
Since redeploying from within the console is working, I'm assuming this is another remote issue with deploys.
Side note:
@thechenky I appreciate you're going off policy, but we're just so sick of function deployment issues.
If you can pass on my feedback to the policy makers at Firebase:
We've been using firebase as our server and database since the 2016 days of firebase-server, and took a big risk running production on the functions beta.
Unfortunately, we're planning on moving away from functions as it is just becoming too unreliable as our business scales. Look back over our support tickets and Github issues, we've had a bad track record of issues with firebase functions in particular, and have spent a lot of developer hours working around limitations, and lost days of sales due to downtime/deployments issues.
I used the response from https://stackoverflow.com/questions/55866695/read-document-in-firestore-from-firebase-oncall-cloud-function . I set my engine to node: 8 in package.json
its working
NodeJS 6 deployments seem to be back to normal for us this morning @JainamJhaveri (No changes made on our side)
Great to hear issues are resolved! And yes, I would recommend setting Node version to 8 (in your package.json) since Node 6 has been announced deprecated by the Google Cloud Functions team.
I've also raised the frustrations many of you voiced about issues not being posted to the dashboard and will follow up on any updates on that if we have them (as I've said, posting thresholds are mandated by Cloud and Firebase policy but I think it's important that community feedback is heard). Thanks again for everyone's patience!!
Closing this out now. If you encounter any other issues please don't hesitate to open another bug.
Not sure if this is the place to put this, but we are experiencing a similar problem.
Only started failing this morning.
Function failed on loading user code. Error message: Code in file index.js can't be loaded. Is there a syntax error in your code? Detailed stack trace: /user_code/node_modules/@google-cloud/bigquery/node_modules/gaxios/build/src/index.js:28 async function request(opts) { ^^^^^^^^ SyntaxError: Unexpected token function at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:549:28) at Object.Module._extensions..js (module.js:586:10) at Module.load (module.js:494:32) at tryModuleLoad (module.js:453:12) at Function.Module._load (module.js:445:3) at Module.require (module.js:504:17) at require (internal/module.js:20:19) at Object.<anonymous> (/user_code/node_modules/@google-cloud/bigquery/node_modules/gcp-metadata/build/src/index.js:17:18)The problem appears to be with BigQuery here rather than Cloud Storage. Not sure if they are linked though?
Reverting to a earlier commit that was working and re-deploying still gives the above error
I am getting the same error. Could anyone please let me know how to overcome this error ASAP.
Most helpful comment
There are issues with cloud storage currently, which is what is causing your deploy errors. The team is working on it and hopefully these will be resolved soon.