1

I am trying to deploy new functions in my firebase project but it started showing an error. I have 5 functions in my index.js file and at any given point, 4 functions are getting deployed and one is throwing this error.

⚠  functions[whenUserIsAdded]: Deployment error.
Function load error: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'firebase-functions'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/user_code/index.js:1:79)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

This happens every time to any one of the 5 functions and this happens in random. I deployed the same code about 2 hours ago and it went smooth. Now after adding some console.log statements, it is showing this error at random with a function.

Can anybody help me with this issue. Thanks in advance.

Also, I am on the blaze plan.

4
  • Did you try deploying it in another project and checking? Commented Nov 30, 2017 at 18:49
  • do you have firebase-admin and firebase-functions included in package.json.? if yes, what version ? Commented Nov 30, 2017 at 18:52
  • Yes. I tried deploying it in another project. Our staging project. It worked and the functions were triggered. I am not being able to deploy in the production project. Commented Nov 30, 2017 at 18:54
  • @Muthukumar Yes. I have them included in the project. "firebase-admin": "^5.2.1", "firebase-functions": "^0.6.3", Commented Nov 30, 2017 at 18:54

1 Answer 1

1

Ok. I think I found the issue. I was having firebase-functions V0.6.3. I believe that was depreciated. Hence it was not working I updated my package.json to the following and it worked. Because functions is still in Beta, I dont think we can do anything about this.

"firebase-admin": "~5.4.2",
"firebase-functions": "^0.7.1",
Sign up to request clarification or add additional context in comments.

2 Comments

The latest versions of those libraries at the time of this writing are 5.5.1 and 0.7.3. Be sure to keep them up to date.
Sure I will. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.