title: Firebase fails to parse private key in production
body: <p>Rather than passing in an actual JSON, I'm retrieving keyvalues from <code>.env</code> and manually setting them <a href="https://stackoverflow.com/questions/50299329/node-js-firebase-service-account-private-key-wont-parse">similar to this</a>.
  When testing locally, everything works fine. In production w/ Elastic Beanstalk, initialization fails:</p>
  <blockquote>
  <p>Dec 29 01:23:41 ip-000-00-00-000 web: /var/app/current/node_modules/firebase-admin/lib/app/credential-internal.js:143</p>
  <p>Dec 29 01:23:41 ip-000-00-00-000 web: throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, 'Failed to parse private key: ' + error);</p>
  <p>Dec 29 01:23:41 ip-000-00-00-000 web: FirebaseAppError: Failed to parse private key: Error: Only 8, 16, 24, or 32 bits supported: 528</p>
  <p>Dec 29 01:23:41 ip-000-00-00-000 web: at FirebaseAppError.FirebaseError [as constructor] (/var/app/current/node_modules/firebase-admin/lib/utils/error.js:44:28)</p>
  </blockquote>
  <p>The only difference is that instead of local <code>.env</code>, I'm pulling environment variables from Elastic Beanstalk:
  <a href="https://i.stack.imgur.com/KVw8I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KVw8I.png" alt="enter image description here" /></a></p>
  <p>And here are the rest:</p>
  <p><code>config.js</code>:</p>
  <pre class="lang-js prettyprint-override"><code>const dotenv = require('dotenv');
  dotenv.config();
  
  const {PORT, TYPE, PROJECT_ID, PRIVATE_KEY_ID, PRIVATE_KEY, ... } = process.env;
  
  module.exports = {
      port: PORT,
      firebaseConfig: {
          type: TYPE,
          projectId: PROJECT_ID,
          privateKeyId: PRIVATE_KEY_ID,
          privateKey: PRIVATE_KEY.replace(/\\n/g, '\n'),
          clientEmail: CLIENT_EMAIL,
          ...
      }
  }
  </code></pre>
  <p><code>db.js</code>:</p>
  <pre class="lang-js prettyprint-override"><code>const config = require('./config'),
      firebase = require('firebase-admin');
  
  const db = firebase.initializeApp({
      credential: firebase.credential.cert(config.firebaseConfig)
  });
  
  module.exports = db;
  </code></pre>
  <p>Thanks in advance!</p>