Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase functions are not being deployed while they used to be deployed without any problem #3605

Closed
jko12130 opened this issue Jul 26, 2021 · 7 comments

Comments

@jko12130
Copy link

jko12130 commented Jul 26, 2021

[REQUIRED] Environment info

firebase-tools:8.9.0

Platform:macOS Big Sur v11.4

[REQUIRED] Test case

package.json:

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase serve --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "10"
  },
  "dependencies": {
    "body-parser": "^1.19.0",
    "child-process-promise": "^2.2.1",
    "express": "^4.17.1",
    "firebase-admin": "^9.11.0",
    "firebase-functions": "^3.14.1",
    "gm": "^1.23.1",
    "lodash": "^4.17.21",
    "mkdirp-promise": "^5.0.1",
    "node-forge": "^0.10.0",
    "sharp": "^0.26.1"
  },
  "devDependencies": {
    "firebase-functions-test": "^0.1.6",
    "tslint": "~5.8.0",
    "typescript": "^3.3.4000"
  },
  "private": true
}

[REQUIRED] Steps to reproduce

Deploy a test function using package.json above

[REQUIRED] Expected behavior

The functions used to be deployed without any problem the last time I tried, which is 2-3 days ago, and should continue to do so.

[REQUIRED] Actual behavior

I cannot deploy any of the functions. All of the functions throw the following errors:

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.

From Firebase console I see the following error messages:

Provided module can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'typescript'

The problem is I have all the necessary packages including Typscript installed.

@jko12130 jko12130 changed the title Firebase functions are not being deployed while they were deployed without any problem Firebase functions are not being deployed while they used to be deployed without any problem Jul 26, 2021
@taeold
Copy link
Contributor

taeold commented Jul 26, 2021

I'm unable to reproduce the issue on my project after copying over the dependencies you've set 😢 .

The error message Detailed stack trace: Error: Cannot find module 'typescript' is a bit cryptic to me - I'm not sure why user code would depend on it. Is there something in your function code that might explain what's going on?

Also, it looks like you are using an older version of the CLI. Can you try giving another go with the latest version of the tool (npm install -g firebase-tools)?

@taeold taeold added the Needs: Author Feedback Issues awaiting author feedback label Jul 26, 2021
@pmabres
Copy link

pmabres commented Jul 26, 2021

I can confirm that this breaks while using firebase as a local package doing:
npm install --save-dev firebase-tools
the installed version is at 8.20.0 while the install w/ the global package is at 9.16.0

For me, using the global package with the firebase command worked well. not happy with being installed as a local package.

Edit:
Installing firebase-tools as:
npm install --save-dev [email protected]
worked fine for deployment, the only issue is that I was unable to compile afterwards so If you're using typescript you'll need to install this: "@types/express-serve-static-core": "^4.17.24",

@jthegedus
Copy link
Contributor

I can confirm that this breaks while using firebase as a local package doing:
npm install --save-dev firebase-tools
the installed version is at 8.20.0 while the install w/ the global package is at 9.16.0

This suggests that the versions 8.20.0 and 9.16.0 perform differently, not that local vs global has different behaviour. Can you compare 9.16.0 when installed locally vs globally?

@pmabres
Copy link

pmabres commented Jul 26, 2021

9.16.0 installed global and locally both work

@jko12130
Copy link
Author

Hi, this works now. It was a really silly mistake. While writing a new function, VS Code was smart enough to somehow automatically import the following module at the top:

const { isExpressionWithTypeArguments } = require('typescript');

Which led to all the errors. Silly mistake. Killed it dead, installed the new version globally, everything's fine. Thanks for helping out though!

@google-oss-bot google-oss-bot added Needs: Attention and removed Needs: Author Feedback Issues awaiting author feedback labels Jul 27, 2021
@pmabres
Copy link

pmabres commented Jul 27, 2021

Even though the creator of the issue might have had a different issue, the versioning problem might still be there.
The only feedback I can provide while I was trying to deploy on GCP are the deployment logs from cloud build.

2021-07-26T05:06:43.259311458Z bad CRC f7974029 (should be 00000000)
2021-07-26T05:06:43.402991199Z ERROR: error fetching storage source: generic::unknown: retry budget exhausted (3 attempts): fetching gcs source: unpacking source from gcs: source fetch container exited with non-zero status: 2

It might be unrelated though.

@taeold
Copy link
Contributor

taeold commented Jul 27, 2021

@pmabres The bad CRC error message reminds me of /issues/3120.

It does sound like a new issue unrelated to this issue. Let us know by opening up a new issue (hopefully w/ steps to reproduce your error).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants