title: Firebase Locally use config variable doesn't work - Error: Missing Plaid "Secret"
body: <p>I am having trouble testing firebase functions locally.
  I have ofc some critical api keys I want to protect. So for that I use <code>functions.config()</code>.</p>
  <p>When launching locally your functions server with <code>firebase emulators:start</code> or <code>firebase emulators:start --only functions</code>, it shows me an error when the <code>secret</code> value is null when using <code>functions.config().plaid.secret</code>.</p>
  <p>I used <code>firebase functions:config:get &gt; .runtimeconfig.json</code> to bring my configuration locally. I ran it in my <code>functions</code> folder.</p>
  <p>The <code>.runtimeconfig.json</code> file looks like this:</p>
  <pre><code>{
    &quot;plaid&quot;: {
      &quot;secret&quot;: &quot;blabla&quot;,
      &quot;clientid&quot;: &quot;blabla&quot;
    }
  }
  </code></pre>
  <p>My <code>index.js</code> looks like the following:</p>
  <pre><code>// Using Express
  const express = require('express');
  const app = express();
  app.use(express.json());
  
  // Cloud Functions
  const functions = require(&quot;firebase-functions&quot;);
  
  // Cloud Firestore
  const admin = require(&quot;firebase-admin&quot;);
  admin.initializeApp();
  const database = admin.firestore();
  
  // Plaid
  const plaid = require(&quot;plaid&quot;);
  const plaidClient = new plaid.Client({
      clientID: functions.config().plaid.clientid,
      secret: functions.config().plaid.secret,
      env: plaid.environments.development,
  });
  
  // Firestore Refs
  const usersRef = database.collection(&quot;users&quot;);
  
  // Token Management
  // Create Token
  app.post('/get_link_token', async (request, response) =&gt; {
      try {
          const clientUserId = &quot;SomeUserID&quot;;
          // Create the link_token with all of your configurations
          const tokenResponse = await plaidClient.createLinkToken({
              user: {
                  client_user_id: clientUserId,
              },
              client_name: 'someproject',
              products: ['auth', 'transactions'],
              country_codes: ['US'],
              language: 'en',
          });
          response.on({ link_token: tokenResponse.link_token });
      } catch (e) {
          // Display error on client
          return response.send({ error: e.message });
      }
  });
  </code></pre>
  <p>My error is the following:</p>
  <pre><code>⚠  functions: The Cloud Firestore emulator is not running, so calls to Firestore will affect production.
  ⚠  Error: Missing Plaid &quot;secret&quot;
      at new Client (/Users/somedude/Work/someproject/functions/node_modules/plaid/lib/PlaidClient.js:17:11)
      at Object.&lt;anonymous&gt; (/Users/somedude/Work/someproject/functions/index.js:18:21)
      at Module._compile (node:internal/modules/cjs/loader:1083:30)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
      at Module.load (node:internal/modules/cjs/loader:948:32)
      at Function.Module._load (node:internal/modules/cjs/loader:789:14)
      at Module.require (node:internal/modules/cjs/loader:972:19)
      at require (node:internal/modules/cjs/helpers:88:18)
      at /usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:699:33
      at Generator.next (&lt;anonymous&gt;)
      at fulfilled (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:5:58)
      at processTicksAndRejections (node:internal/process/task_queues:93:5)
  ⚠  We were unable to load your functions code. (see above)
  
  </code></pre>
  <p>Do you have any idea what I am doing wrong here?</p>
  <p>Thanks in advance!</p>
  <p>Edit: You have a little bit more context here <a href="https://github.com/plaid/plaid-node/issues/345" rel="noreferrer">https://github.com/plaid/plaid-node/issues/345</a>
  Still not solved on my end.</p>