Watch keynotes and sessions from, our virtual developer conference.

Stitch cannot parse private key

I’m trying to initializeApp with firebase-admin and I’ve uploaded the dependencies.

I’m creating a trigger function so I can generate a JWT token, to be sent to firebase for authentication.

The same code below works for my backend server, but when I try to use it in Stitch function, it returns “Error: Failed to parse private key: Error: Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.” as error.

var admin = require('firebase-admin')
        try {
            admin.initializeApp({credential: admin.credential.cert({
                "project_id": "someproject-id",
                "private_key": "-----BEGIN PRIVATE KEY-----\nKEY\n-----END PRIVATE KEY-----\n",
                "client_email": "",
            } catch(err) {
        //var token = await admin.auth().createCustomToken(uid)
        console.log('token', token)  

Hi Dave – Looks like this may be a place where we want to extend how our dependency resolution works. Would you mind sharing the version of ‘firebase-admin’ that you’re using so we can try to reproduce?


I am having the same exact problem with firebase-admin 8.12.1

Please help.

Same here 8.13.0