# Using Firebase Admin SDK with Lambda Function

**URL:** <https://answers.netlify.com/t/using-firebase-admin-sdk-with-lambda-function/2136>\
**Category:** Support\
**Tags:** lambda-functions\
**Created:** [July 17, 2019, 12:07am UTC](https://answers.netlify.com/t/using-firebase-admin-sdk-with-lambda-function/2136 "2019-07-17T00:07:00Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![AnthonyFromTheVault](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@AnthonyFromTheVault](https://answers.netlify.com/u/AnthonyFromTheVault)\
**Post date:** [July 17, 2019, 6:00pm UTC](https://answers.netlify.com/t/using-firebase-admin-sdk-with-lambda-function/2136/2 "2019-07-17T18:00:01Z")

</div>

Per the recommendation of [other posts](https://answers.netlify.com/t/how-to-hide-stripe-secret-key-using-lambda-function/1800) in this community I’ve also tried deploying the function without the use of dotenv, and also used some regex text replacement for the private key because it has `\n` escaped characters by default.

And that was the secret combo to get this working! Downside is I have to have a different method for local env variables, but good news is I’m finally working with serverless functions!

For anyone else who runs into this problem, make sure the private key you’re passing into the service credential object is replacing these characters:

```auto
const serviceCredential = {
  // ...
  private_key: process.env.FB_PRIVATE_KEY.replace(/\\n/g, '\n'),
  // ...
}

```

---

_[View the full topic](https://answers.netlify.com/t/using-firebase-admin-sdk-with-lambda-function/2136)._
