Reputation: 10729
I have deployed the three functions successfully for a couple of month, and now it suddenly started trippin' on me. I haven't changed the node, npm or firebase cli versions for a while. I upgraded the npm packages within the functions directory as a desperation to fix this, but no luck. Why is this happening? Repo (hoverboard-v2 branch): https://github.com/gdgfresno/valleydevfest2017/tree/hoverboard-v2/functions
Ubuntu 17.04, console deployment
npm --version
5.5.1
node --version
v8.1.0
firebase --version
3.13.1
Here is the error:
Deployment failure:
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-admin'
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/node_modules/firebase-functions/lib/apps.js:25:16)
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)
package.json:
{
"name": "hoverboard-functions",
"description": "Hoverboard serverless functions",
"dependencies": {
"firebase-admin": "^5.4.2",
"firebase-functions": "^0.6.2",
"moment": "^2.19.1"
},
"private": true
}
index.js:
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.sendGeneralNotification = require('./notifications');
exports.scheduleNotifications = require('./schedule-notifications');
exports.saveUserData = require('./users');
Upvotes: 1
Views: 3511
Reputation: 13
I have sorted it out using previous versions:
npm install --save-exact [email protected]
npm install --save-exact [email protected]
At least until it would be resolved
Upvotes: 0
Reputation: 1208
Same issue here. It is a firebase problem.
There is disruption in firebase cloud service since yesterday.
problem description: https://status.firebase.google.com/incident/Functions/17024
problem solution:
Run the following commands inside the functions repository:
npm install --save-exact [email protected] npm install --save-exact [email protected]
Then try deploying functions again:
firebase deploy --only functions
I hope this helps :)
Upvotes: 3