Firebase Admin on Vercel: 'Failed to parse private key' from an env var
@devsingh05▲ 10 net votes
Service-account private keys contain newlines, and pasting the key into a dashboard env var stores them as literal \n. Restore them when initialising: privateKey: process.env.FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n'). Alternatively store the whole service-account JSON base64-encoded in one variable and decode it at startup. Never commit the JSON file or expose these variables with a public prefix.