2

I added Firebase Functions secrets via the CLI as described in the docs. The secrets are populated correctly in process.env both in deployed and emulated functions UNLESS the --inspect-functions flag is set. In that case, the secrets in process.env are undefined and no errors are displayed.


The issue only occurs when I run: firebase emulators:start --inspect-functions. Other notes:

  • I have the correct permissions set for the service account and there are no permissions errors.

  • I'm using .runWith correctly, since the same code works in the other environments. Here's how it's structured:

    exports.functionName = functions
        .runWith({secrets: ['SECRET_KEY', "SECRET_KEY_TEST"]})
        .https.onCall(async (data, context) => {
            // Code here.
    });
    
  • There are no errors when the emulators start, which you'd expect if the configuration had a problem.

There is no mention of this being a limitation in the functions docs. The emulator docs mention the --inspect-functions flag causes a subtle behavior difference, but it doesn't seem relevant:

Note that when this flag is supplied, the Cloud Functions emulator switches to a special serialized execution mode in which functions are executed in a single process, in sequential (FIFO) order; this simplifies function debugging, though the behavior differs from multi-process, parallel execution of functions in the cloud.

I'm running firebase-tools version 10.7.0 on Windows 10. Thanks for any assistance figuring this one out!

Bjorn Hansen
  • 329
  • 5
  • 12

0 Answers0