firebase-tools: firebase-tools@11.24.0 doesn't recognize functions config in CI

[REQUIRED] Environment info

firebase-tools: 11.24.0

Platform: GitHub Actions (Current runner version: ‘2.299.1’) running ubuntu-latest.

[REQUIRED] Test case

I don’t have one, but I have a picture of the output of the CI run. Will attach below.

[REQUIRED] Steps to reproduce

image Our unit tests fail with the CI complaining that the config object from firebase-functions package is empty. However, this does not happen locally (all tests pass).

We were previously using a fixed version (firebase-tools@11.2.2) instead of latest because we ran into some issues, however, recently trying to deploy functions from CI using 11.2.2 would fail with this error:

image

While investigating in Stack Overflow, the suggestion was to update the firebase-tools package, which is what I just did today and now I found this bug.

Not sure if this is relevant but a while back this same bug happened to us under 9.19.0 (see https://github.com/firebase/firebase-tools/issues/3793), the key difference here is that in the previous report the issue was local, while here the issue happens only in CI (GitHub Actions)

[REQUIRED] Expected behavior

functions.config() to be populated as usual in CI env.

[REQUIRED] Actual behavior

functions.config() is empty when running in CI.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Hey @taeold thanks for looking into this. Setting CLOUD_RUNTIME_CONFIG to our .runtimeconfig.json path did the trick. There wasn’t a need to inline the entire config.

I’m still unsure why the emulator was unable to find .runtimeconfig.json after upgrading past 11.4.0, but glad to have this working again. I confirmed nothing changed with our file structure or CI, and there is definitely a .runtimeconfig.json file in process.cwd() while the tests are running.

In case it’s useful for troubleshooting this for others, here are a few unique things about our setup:

  • We only run the firestore emulator for our unit tests. The command we run is firebase emulators:exec --only firestore \"jest ...\"
  • Our cloud functions are in a monorepo powered by NX that doesn’t have the typical top-level functions directory. The functions source code apps/functions and our dist is in dist/apps/functions.
  • We use azure pipelines for CI

Also having this issue in 11.25.2 (latest as of today). FWIW we authenticate using FIREBASE_TOKEN and receive the expected deprecation warning, but there were no issues retrieving the config and writing it to .runtimeconfig.json. The config also loads fine when running locally (macOS).