- Notifications
You must be signed in to change notification settings - Fork 407
Closed
Description
Describe your environment
- Operating System version: AWS Lambda
- Firebase SDK version: 5.11.0
- Firebase Product: Firestore
Describe the problem
I have been trying to connect my lambda function with Firestore DB using Admin SDK but its throwing error "module initialisation error: Error"
Its clearly an issue with Firesbase admin sdk, as every-time I comment this component, the rest of the component works fine. Could you please let me know what is the issue?
Steps to reproduce:
What happened? How can we make the problem occur?
This could be a description, log/console output, etc.
Relevant Code:
'use strict'; const Alexa = require('alexa-sdk'); const firebase = require('firebase-admin'); const APP_ID = '---'; const SKILL_NAME = '----'; const HELP_MESSAGE = '---'; const HELP_REPROMPT = '----'; const STOP_MESSAGE = '---'; module.exports.Test = (event, context, callback) => { context.callbackWaitsForEmptyEventLoop = false; if (firebase.apps.length == 0) { firebase.initializeApp({ credential: firebase.credential.cert('---'), databaseURL: "---" }); } var db = firebase.firestore(); var docRef = db.collection('users') .doc('alovelace'); var setAda = docRef.set({ first: 'Ada', last: 'Lovelace', born: 1815 }); }; const handlers = { 'LaunchRequest': function () { this.emit('BasicFunction'); }, //Help 'AMAZON.HelpIntent': function () { const speechOutput = HELP_MESSAGE; const reprompt = HELP_REPROMPT; this.response.speak(speechOutput) .listen(reprompt); this.emit(':responseReady'); }, //Cancel 'AMAZON.CancelIntent': function () { this.response.speak(STOP_MESSAGE); this.emit(':responseReady'); }, //Stop 'AMAZON.StopIntent': function () { this.response.speak(STOP_MESSAGE); this.emit(':responseReady'); }, }; exports.handler = function (event, context, callback) { const alexa = Alexa.handler(event, context, callback); alexa.APP_ID = APP_ID; alexa.registerHandlers(handlers); alexa.execute(); }; ####Logs from CloudWatch
module initialization error: Error at FirebaseAppError.Error (native) at FirebaseAppError.FirebaseError [as constructor] (/var/task/node_modules/firebase-admin/lib/utils/error.js:39:28) at FirebaseAppError.PrefixedFirebaseError [as constructor] (/var/task/node_modules/firebase-admin/lib/utils/error.js:85:28) at new FirebaseAppError (/var/task/node_modules/firebase-admin/lib/utils/error.js:119:28) at Function.Certificate.fromPath (/var/task/node_modules/firebase-admin/lib/auth/credential.js:142:19) at new CertCredential (/var/task/node_modules/firebase-admin/lib/auth/credential.js:192:25) at Object.cert (/var/task/node_modules/firebase-admin/lib/firebase-namespace.js:224:58) at Object.<anonymous> (/var/task/index.js:14:41) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) Metadata
Metadata
Assignees
Labels
No labels