I\'m trying to create an Heroku node task that reads data from Firebase and console.log it.
My node script (located inside the /bin directory) is:
re
I had the same problem today. You need to sanitize the read private key by replacing \\n characters with \n.
admin.initializeApp({
credential: admin.credential.cert({
"projectId": process.env.FIREBASE_PROJECT_ID,
"private_key": process.env.FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n'),
"clientEmail": process.env.FIREBASE_CLIENT_EMAIL,
}),
databaseURL: process.env.FIREBASE_DATABASE_URL,
});