question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

[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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jko12130commented, Jul 27, 2021

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!

0reactions
taeoldcommented, Jul 27, 2021

@pmabres The bad CRC error message reminds me of firebase/firebase-tools/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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Functions did not deploy properly - firebase
Try running deploy with --debug . For example: firebase --debug deploy . In my case the function looked like this:
Read more >
Manage functions | Cloud Functions for Firebase - Google
You can deploy, delete, and modify functions using Firebase CLI commands or by setting runtime options in your functions source code. Deploy functions....
Read more >
When Your Firebase Cloud Functions Don't Want to Deploy ...
TL;DR — I fixed the issue by setting my local and Cloud Functions Node.js version to 12. The Story. I have always used...
Read more >
Deploying 150+ functions is very slow - Google Groups
I understand that the architecture of cloud functions is such that each function is updated individually, but this can be quite slow when...
Read more >
Firebase deploy functions fails - Atlassian Community
But with de pipeline, firebase-deploy version 2.0.0 it seems is not detecting my functions folder and return me an error saying me that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found