In my TypeScript file, I have the following:
import * as admin from 'firebase-admin'
import * as functions from 'firebase-functions'
const serviceAccountKey = "serviceAccountKey.json"
const databaseURL = "https://blahblah.firebaseio.com"
admin.initializeApp({
credential: admin.credential.cert(serviceAccountKey),
databaseURL: databaseURL
});
My functions run fine in the emulator (which can only happen if the json key is successfully passed) but when I try to deploy them, I get the following error:
Error: Error occurred while parsing your function triggers.
Error: Failed to parse certificate key file: Error: ENOENT: no such file or directory, open 'serviceAccountKey.json'
I've tried moving the json file to the root folder, the lib folder (where the index.js file resides), the functions folder, without any luck. How do I pass the key when deploying?