firebase-tools: Callable function in emulator returns 'unauthenticated' when passing in mock auth via firebase/testing lib

Not sure if this is the right place for this report, or if perhaps I am using the emulators/sdk incorrectly. I would like to write some integration tests and run against the Firebase emulator suite. I found the docs on testing security rules helpful, and it seems like the intention of the @firebase/testing library is to allow testing of functions/database beyond just security rules.

That doc outlines how to mock authentication by passing and auth dictionary to initializeTestApp(..), but when I use the resulting app to call an httpsCallable function, the emulator returns an ‘unauthenticated’ error.

[REQUIRED] Environment info

firebase-tools: 7.0.2 Platform: macOS 10.14.5

[REQUIRED] Test case

Here is a minimal reproduction: https://github.com/ryanmeisters/firebase-callable-emulator-test

It contains a single helloCallable function that returns {hello: "world"}, and a single test that calls the function and verifies the response. The test passes when no auth is passed into initializeTestApp, but gets ‘unauthenticated’ error if auth is passed.

[REQUIRED] Steps to reproduce

  1. Clone the above repo and npm install
  2. in the root run ./emulate.sh (compiles typescript and runs emulators)
  3. cd functions && npm run test # test fails with 'unauthenticated'
  4. comment out this line and npm run test again. Test passes

[REQUIRED] Expected behavior

The callable function should be called and receive the mock auth dictionary

[REQUIRED] Actual behavior

Function returns and unauthenticated error.

Output of firebase emulators:start --debug and function call

➜  FirebaseTestingCallable git:(master) ./emulate.sh

> functions@ build /Users/ryan/Projects/FirebaseTestingCallable/functions
> tsc

[2019-07-06T17:00:46.379Z] ----------------------------------------------------------------------
[2019-07-06T17:00:46.382Z] Command:       /Users/ryan/.nvm/versions/node/v8.15.1/bin/node /Users/ryan/.nvm/versions/node/v8.15.1/bin/firebase emulators:start --debug
[2019-07-06T17:00:46.382Z] CLI Version:   7.0.2
[2019-07-06T17:00:46.382Z] Platform:      darwin
[2019-07-06T17:00:46.382Z] Node Version:  v8.15.1
[2019-07-06T17:00:46.383Z] Time:          Sat Jul 06 2019 10:00:46 GMT-0700 (PDT)
[2019-07-06T17:00:46.383Z] ----------------------------------------------------------------------

[2019-07-06T17:00:46.392Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-07-06T17:00:46.392Z] > authorizing via signed-in user
[2019-07-06T17:00:46.394Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[2019-07-06T17:00:46.394Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
 <request body omitted>
[2019-07-06T17:00:46.686Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=utf-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sat, 06 Jul 2019 17:00:46 GMT, server=scaffolding on HTTPServer2, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-07-06T17:00:46.697Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/testproject-dbefa

[2019-07-06T17:00:47.139Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sat, 06 Jul 2019 17:00:47 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=252, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked
i  Starting emulators: ["functions","firestore"]
✔  functions: Using node@8 from host.
[2019-07-06T17:00:47.157Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/1077985712794:getServerAppConfig

[2019-07-06T17:00:47.450Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sat, 06 Jul 2019 17:00:47 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked
✔  functions: Emulator started at http://localhost:5001
[2019-07-06T17:00:47.716Z] Starting emulator firestore with args {"host":"localhost","port":8080,"rules":"/Users/ryan/Projects/FirebaseTestingCallable/firestore.rules","functions_emulator":"localhost:5001"}
i  firestore: Logging to firestore-debug.log
✔  firestore: Emulator started at http://localhost:8080
[2019-07-06T17:00:48.406Z] API endpoint: http://localhost:8080
[2019-07-06T17:00:48.406Z]
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:

   export FIRESTORE_EMULATOR_HOST=localhost:8080

Dev App Server is now running.


i  firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
i  functions: Watching "/Users/ryan/Projects/FirebaseTestingCallable/functions" for Cloud Functions...
[2019-07-06T17:00:48.674Z] Functions runtime initialized.
[2019-07-06T17:00:48.675Z] Disabled runtime features: undefined
[2019-07-06T17:00:48.795Z] Found google-gax at /Users/ryan/Projects/FirebaseTestingCallable/functions/node_modules/google-gax/build/src/index.js
[2019-07-06T17:00:48.795Z] Outgoing network have been stubbed.
[2019-07-06T17:00:48.823Z] Checked functions.config()
[2019-07-06T17:00:48.826Z] firebase-admin has been stubbed.
[2019-07-06T17:00:48.827Z] config() parent accessed!
i  functions: HTTP trigger initialized at http://localhost:5001/testproject-dbefa/us-central1/helloCallable
[2019-07-06T17:01:11.648Z] File /Users/ryan/Projects/FirebaseTestingCallable/functions/lib/index.tests.js.map changed, reloading triggers
[2019-07-06T17:01:11.648Z] File /Users/ryan/Projects/FirebaseTestingCallable/functions/lib/index.tests.js changed, reloading triggers
[2019-07-06T17:01:11.649Z] File /Users/ryan/Projects/FirebaseTestingCallable/functions/lib/index.js.map changed, reloading triggers
[2019-07-06T17:01:11.649Z] File /Users/ryan/Projects/FirebaseTestingCallable/functions/lib/index.js changed, reloading triggers
[2019-07-06T17:01:12.794Z] Accepted request POST /testproject-dbefa/us-central1/helloCallable --> helloCallable
[2019-07-06T17:01:12.838Z] Functions runtime initialized.
[2019-07-06T17:01:12.839Z] Disabled runtime features: undefined
[2019-07-06T17:01:12.955Z] Found google-gax at /Users/ryan/Projects/FirebaseTestingCallable/functions/node_modules/google-gax/build/src/index.js
[2019-07-06T17:01:12.955Z] Outgoing network have been stubbed.
[2019-07-06T17:01:12.987Z] Checked functions.config()
[2019-07-06T17:01:12.987Z] Functions runtime initialized.
i  functions: Beginning execution of "helloCallable"
[2019-07-06T17:01:12.988Z] Disabled runtime features: undefined
[2019-07-06T17:01:12.989Z] firebase-admin has been stubbed.
[2019-07-06T17:01:12.989Z] config() parent accessed!
[2019-07-06T17:01:13.101Z] Found google-gax at /Users/ryan/Projects/FirebaseTestingCallable/functions/node_modules/google-gax/build/src/index.js
[2019-07-06T17:01:13.101Z] Outgoing network have been stubbed.
[2019-07-06T17:01:13.130Z] Checked functions.config()
[2019-07-06T17:01:13.131Z] firebase-admin has been stubbed.
[2019-07-06T17:01:13.132Z] config() parent accessed!
[2019-07-06T17:01:13.133Z] Trigger "helloCallable" has been found, beginning invocation!
[2019-07-06T17:01:13.133Z]
[2019-07-06T17:01:13.133Z] Running helloCallable in mode HTTPS
[2019-07-06T17:01:13.139Z] {"socketPath":"/var/folders/8j/lw39pjg97xbckxh0bk7rtw8r0000gn/T/firebase_emulator_invocation_74956.sock"}

Output of npm run test

➜  functions git:(master) ✗ npm run test

> functions@ test /Users/ryan/Projects/FirebaseTestingCallable/functions
> tsc && ava -v --serial


  ✖ we are able to call the callable function Rejected promise returned by test

  1 test failed

  we are able to call the callable function

  /Users/ryan/Projects/FirebaseTestingCallable/functions/node_modules/@firebase/functions/src/api/error.ts:66

  Rejected promise returned by test. Reason:

  Error (HttpsErrorImpl) {
    code: 'unauthenticated',
    details: undefined,
    message: 'Unauthenticated',
  }

  new HttpsErrorImpl (node_modules/@firebase/functions/src/api/error.ts:66:5)
  _errorForResponse (node_modules/@firebase/functions/src/api/error.ts:175:10)
  Service.<anonymous> (node_modules/@firebase/functions/src/api/service.ts:226:19)
  step (node_modules/tslib/tslib.js:133:27)
  Object.next (node_modules/tslib/tslib.js:114:57)
  fulfilled (node_modules/tslib/tslib.js:104:62)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ test: `tsc && ava -v --serial`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ryan/.npm/_logs/2019-07-06T17_01_13_235Z-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@ryanmeisters by the way you can check if (process.env.FUNCTIONS_EMULATOR) to know when your code is running in the emulator and when it’s not

Version 7.16.2 has been released.

@eowo @seki2020 thank you for pointing this out. It looks like the library jsonwebtoken.decode() does not like the JWTs returned from @firebase/testing whereas it does accept real production Firebase JWTs (which is what I used for testing). I will dig into this and get a fix out this morning.

Filed this bug with the testing SDK: https://github.com/firebase/firebase-js-sdk/issues/2803

We can work around it in the CLI though, PR coming.

The fix has been released in 7.16.0

@luke-studley sorry about that experience and thanks for the bump! You inspired me to dig deeper and I found a solution I am happy with. PR on the way, this will be fixed in the next release.

@seki2020 is right, we have this issue again in version 7.16.1

Hi folks, I need to remind something here. I found that this issue was fixed by v7.16.0 but perhaps fail by v7.16.1.

[REQUIRED] Steps to reproduce

I am using this repo Actually, to replace nothing but projectId to your own project. Don’t comment out auth: { uid: "alice", email: "alice@example.com" }

ps: All steps are same as what @ryanmeisters did in this issue.

Test Environment

MacOS: 10.15.3

ps: Please close all and reopen new command windows once you have updated versions of firebase-tools.

Firebase-tools: v7.16.1

run npm run test the result is

ximing@ximings-MacBook-Air:~/Documents/GitHub/firebase-callable-emulator-test/functions$ npm run test

> functions@ test /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions
> tsc && ava -v --serial


  ✖ we are able to call the callable function Rejected promise returned by test

  1 test failed

  we are able to call the callable function

  /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/@firebase/functions/src/api/error.ts:66

  Rejected promise returned by test. Reason:

  Error (HttpsErrorImpl) {
    code: 'unauthenticated',
    details: undefined,
    message: 'Unauthenticated',
  }

  new HttpsErrorImpl (node_modules/@firebase/functions/src/api/error.ts:66:5)
  _errorForResponse (node_modules/@firebase/functions/src/api/error.ts:175:10)
  Service.<anonymous> (node_modules/@firebase/functions/src/api/service.ts:226:19)
  step (node_modules/tslib/tslib.js:133:27)
  Object.next (node_modules/tslib/tslib.js:114:57)
  fulfilled (node_modules/tslib/tslib.js:104:62)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ test: `tsc && ava -v --serial`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the functions@ test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Debug Info by Emulator is

Dev App Server is now running.


✔  firestore: firestore emulator started at http://localhost:8080
i  firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
i  functions: Watching "/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions" for Cloud Functions...
[2020-03-26T00:45:25.278Z] [worker-pool] addWorker(~diagnostic~)
[2020-03-26T00:45:25.279Z] [worker-pool] Adding worker with key ~diagnostic~, total=1
[2020-03-26T00:45:25.279Z] [worker-pool] submitWork(triggerId=)
[2020-03-26T00:45:25.280Z] [worker-~diagnostic~-a86b9383-4c61-4e54-a775-045caca83b66]: Assigning socketPath: /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/fire_emu_11220.sock
[2020-03-26T00:45:25.282Z] [worker-~diagnostic~-a86b9383-4c61-4e54-a775-045caca83b66]: BUSY
[2020-03-26T00:45:25.651Z] [runtime-status] [11220] Functions runtime initialized. {"cwd":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions","node_version":"10.16.1"}
[2020-03-26T00:45:25.653Z] [runtime-status] [11220] Disabled runtime features: undefined
[2020-03-26T00:45:25.657Z] [runtime-status] [11220] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:45:25.660Z] [runtime-status] [11220] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:45:26.101Z] [runtime-status] [11220] Found google-gax at /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/google-gax/build/src/index.js
[2020-03-26T00:45:26.102Z] [runtime-status] [11220] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"},{"name":"google-gax","status":"mocked"}]
[2020-03-26T00:45:26.179Z] [runtime-status] [11220] Checked functions.config() {"config":{}}
[2020-03-26T00:45:26.181Z] [runtime-status] [11220] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:45:26.183Z] [runtime-status] [11220] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:45:26.184Z] [runtime-status] [11220] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:45:26.246Z] [runtime-status] [11220] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}}
[2020-03-26T00:45:26.247Z] [runtime-status] [11220] config() parent accessed! {"parentKey":"firebase","parentConfig":{}}
[2020-03-26T00:45:26.248Z] [runtime-status] [11220] initializeApp(DEFAULT) {"databaseURL":"https://test-functions-emulators.firebaseio.com","storageBucket":"test-functions-emulators.appspot.com","projectId":"test-functions-emulators"}
⚠  functions: You're using firebase-functions v3.0.2, please upgrade to firebase-functions v3.3.0 or higher for best results.
[2020-03-26T00:45:26.382Z] [worker-~diagnostic~-a86b9383-4c61-4e54-a775-045caca83b66]: IDLE
✔  functions[helloCallable]: http function initialized (http://localhost:5001/test-functions-emulators/us-central1/helloCallable).
✔  emulators: All emulators started, it is now safe to connect.
[2020-03-26T00:46:23.741Z] File /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/lib/index.tests.js.map changed, reloading triggers
[2020-03-26T00:46:23.742Z] File /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/lib/index.tests.js changed, reloading triggers
[2020-03-26T00:46:23.743Z] File /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/lib/index.js.map changed, reloading triggers
[2020-03-26T00:46:23.743Z] File /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/lib/index.js changed, reloading triggers
[2020-03-26T00:46:24.744Z] [worker-pool] Shutting down IDLE worker (~diagnostic~)
[2020-03-26T00:46:24.744Z] [worker-~diagnostic~-a86b9383-4c61-4e54-a775-045caca83b66]: FINISHING
[2020-03-26T00:46:24.753Z] [worker-pool] addWorker(~diagnostic~)
[2020-03-26T00:46:24.754Z] [worker-pool] Adding worker with key ~diagnostic~, total=2
[2020-03-26T00:46:24.754Z] [worker-pool] submitWork(triggerId=)
[2020-03-26T00:46:24.755Z] [worker-~diagnostic~-32e427fa-1e8f-4c54-ab0c-8bb23a1862bb]: Assigning socketPath: /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/fire_emu_11265.sock
[2020-03-26T00:46:24.755Z] [worker-~diagnostic~-32e427fa-1e8f-4c54-ab0c-8bb23a1862bb]: BUSY
[2020-03-26T00:46:24.757Z] [worker-~diagnostic~-a86b9383-4c61-4e54-a775-045caca83b66]: exited
[2020-03-26T00:46:24.757Z] [worker-~diagnostic~-a86b9383-4c61-4e54-a775-045caca83b66]: FINISHED
[2020-03-26T00:46:25.298Z] [runtime-status] [11265] Functions runtime initialized. {"cwd":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions","node_version":"10.16.1"}
[2020-03-26T00:46:25.301Z] [runtime-status] [11265] Disabled runtime features: undefined
[2020-03-26T00:46:25.304Z] [runtime-status] [11265] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:46:25.306Z] [runtime-status] [11265] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:46:25.614Z] [runtime-status] [11265] Found google-gax at /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/google-gax/build/src/index.js
[2020-03-26T00:46:25.615Z] [runtime-status] [11265] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"},{"name":"google-gax","status":"mocked"}]
[2020-03-26T00:46:25.699Z] [runtime-status] [11265] Checked functions.config() {"config":{}}
[2020-03-26T00:46:25.700Z] [runtime-status] [11265] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:46:25.704Z] [runtime-status] [11265] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:46:25.704Z] [runtime-status] [11265] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:46:25.771Z] [runtime-status] [11265] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}}
[2020-03-26T00:46:25.773Z] [runtime-status] [11265] config() parent accessed! {"parentKey":"firebase","parentConfig":{}}
[2020-03-26T00:46:25.776Z] [runtime-status] [11265] initializeApp(DEFAULT) {"databaseURL":"https://test-functions-emulators.firebaseio.com","storageBucket":"test-functions-emulators.appspot.com","projectId":"test-functions-emulators"}
[2020-03-26T00:46:25.869Z] [worker-~diagnostic~-32e427fa-1e8f-4c54-ab0c-8bb23a1862bb]: IDLE
[2020-03-26T00:46:27.040Z] [work-queue] {"queueLength":1,"workRunningCount":0}
[2020-03-26T00:46:27.041Z] [work-queue] {"queueLength":0,"workRunningCount":1}
[2020-03-26T00:46:27.041Z] Accepted request POST /test-functions-emulators/us-central1/helloCallable --> helloCallable
[2020-03-26T00:46:27.042Z] ID Token: eyJhbGciOiJub25lIiwia2lkIjoiZmFrZWtpZCJ9.eyJ1aWQiOiJhbGljZSIsImVtYWlsIjoiYWxpY2VAZXhhbXBsZS5jb20iLCJpYXQiOjAsInN1YiI6ImFsaWNlIn0=.
[2020-03-26T00:46:27.042Z] [worker-pool] Cleaned up workers for ~diagnostic~: 2 --> 1
[2020-03-26T00:46:27.045Z] [worker-pool] addWorker(helloCallable)
[2020-03-26T00:46:27.045Z] [worker-pool] Adding worker with key helloCallable, total=1
[2020-03-26T00:46:27.046Z] [worker-pool] submitWork(triggerId=helloCallable)
[2020-03-26T00:46:27.046Z] [worker-helloCallable-8ccb6dfa-619d-4d6a-97c3-82562636037d]: Assigning socketPath: /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/fire_emu_11276.sock
[2020-03-26T00:46:27.046Z] [worker-helloCallable-8ccb6dfa-619d-4d6a-97c3-82562636037d]: BUSY
[2020-03-26T00:46:27.338Z] [runtime-status] [11276] Functions runtime initialized. {"cwd":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions","node_version":"10.16.1"}
[2020-03-26T00:46:27.340Z] [runtime-status] [11276] Disabled runtime features: undefined
[2020-03-26T00:46:27.343Z] [runtime-status] [11276] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:46:27.344Z] [runtime-status] [11276] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:46:27.507Z] [runtime-status] [11276] Found google-gax at /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/google-gax/build/src/index.js
[2020-03-26T00:46:27.507Z] [runtime-status] [11276] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"},{"name":"google-gax","status":"mocked"}]
[2020-03-26T00:46:27.555Z] [runtime-status] [11276] Checked functions.config() {"config":{}}
[2020-03-26T00:46:27.556Z] [runtime-status] [11276] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:46:27.559Z] [runtime-status] [11276] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:46:27.559Z] [runtime-status] [11276] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:46:27.599Z] [runtime-status] [11276] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}}
[2020-03-26T00:46:27.601Z] [runtime-status] [11276] config() parent accessed! {"parentKey":"firebase","parentConfig":{}}
[2020-03-26T00:46:27.605Z] [runtime-status] [11276] initializeApp(DEFAULT) {"databaseURL":"https://test-functions-emulators.firebaseio.com","storageBucket":"test-functions-emulators.appspot.com","projectId":"test-functions-emulators"}
[2020-03-26T00:46:27.682Z] [runtime-status] [11276] Trigger "helloCallable" has been found, beginning invocation!
i  functions: Beginning execution of "helloCallable"
[2020-03-26T00:46:27.683Z] [runtime-status] [11276] triggerDefinition {"httpsTrigger":{},"labels":{"deployment-callable":"true"},"name":"helloCallable","entryPoint":"helloCallable"}
[2020-03-26T00:46:27.683Z] [runtime-status] [11276] Running helloCallable in mode HTTPS
[2020-03-26T00:46:27.699Z] [runtime-status] [11276] Attempting to listen to socketPath: /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/fire_emu_11276.sock
[2020-03-26T00:46:27.719Z] [functions] Runtime ready! Sending request!
[2020-03-26T00:46:27.782Z] [runtime-status] [11276] Ephemeral server handling POST request
[2020-03-26T00:46:27.837Z] [runtime-status] [11276] Ephemeral server survived.
i  functions: Finished "helloCallable" in ~1s
[2020-03-26T00:46:27.851Z] [worker-helloCallable-8ccb6dfa-619d-4d6a-97c3-82562636037d]: IDLE
[2020-03-26T00:46:27.851Z] [work-queue] {"queueLength":0,"workRunningCount":0}

Firebase-tools: v7.16.0

run npm run test

ximing@ximings-MacBook-Air:~/Documents/GitHub/firebase-callable-emulator-test/functions$ npm run test

> functions@ test /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions
> tsc && ava -v --serial


  ✔ we are able to call the callable function (759ms)

  1 test passed

Debug Info by Emulator is

ximing@ximings-MacBook-Air:~/Documents/GitHub/firebase-callable-emulator-test$ ./emulate.sh 

> functions@ build /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions
> tsc

[2020-03-26T00:49:17.608Z] ----------------------------------------------------------------------
[2020-03-26T00:49:17.613Z] Command:       /Users/ximing/.nvm/versions/node/v10.16.1/bin/node /Users/ximing/.config/yarn/global/node_modules/.bin/firebase emulators:start --debug
[2020-03-26T00:49:17.614Z] CLI Version:   7.16.0
[2020-03-26T00:49:17.614Z] Platform:      darwin
[2020-03-26T00:49:17.614Z] Node Version:  v10.16.1
[2020-03-26T00:49:17.615Z] Time:          Thu Mar 26 2020 08:49:17 GMT+0800 (China Standard Time)
[2020-03-26T00:49:17.615Z] ----------------------------------------------------------------------
[2020-03-26T00:49:17.615Z] 
[2020-03-26T00:49:17.640Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-03-26T00:49:17.641Z] > authorizing via signed-in user
i  emulators: Starting emulators: functions, firestore
⚠  emulators: It seems that you are running multiple instances of the emulator suite for project test-functions-emulators. This may result in unexpected behavior.
[2020-03-26T00:49:17.783Z] [hub] writing locator at /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/hub-test-functions-emulators.json
✔  hub: emulator hub started at http://localhost:4400
⚠  Your requested "node" version "8" doesn't match your global version "10"
✔  functions: functions emulator started at http://localhost:5001
i  firestore: Serving ALL traffic (including WebChannel) on http://localhost:8080
⚠  firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and will go away soon. Please use port above instead.
[2020-03-26T00:49:17.863Z] Ignoring unsupported arg: projectId
[2020-03-26T00:49:17.863Z] Ignoring unsupported arg: auto_download
[2020-03-26T00:49:17.863Z] Starting firestore emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/Users/ximing/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.1.jar","--host","localhost","--port",8080,"--rules","/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/firestore.rules","--functions_emulator","localhost:5001","--webchannel_port",8081],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator","seed_from_export"],"joinArgs":false}
i  firestore: firestore emulator logging to firestore-debug.log
[2020-03-26T00:49:19.062Z] API endpoint: http://localhost
[2020-03-26T00:49:19.063Z] :8080
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:

   export FIRESTORE_EMULATOR_HOST=localhost:8080

Dev App Server is now running.


✔  firestore: firestore emulator started at http://localhost:8080
i  firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
i  functions: Watching "/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions" for Cloud Functions...
[2020-03-26T00:49:19.179Z] [worker-pool] addWorker(~diagnostic~)
[2020-03-26T00:49:19.180Z] [worker-pool] Adding worker with key ~diagnostic~, total=1
[2020-03-26T00:49:19.180Z] [worker-pool] submitWork(triggerId=)
[2020-03-26T00:49:19.181Z] [worker-~diagnostic~-23bcde8f-06b0-45b3-b89c-4475523fcd20]: Assigning socketPath: /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/fire_emu_11930.sock
[2020-03-26T00:49:19.182Z] [worker-~diagnostic~-23bcde8f-06b0-45b3-b89c-4475523fcd20]: BUSY
[2020-03-26T00:49:19.549Z] [runtime-status] [11930] Functions runtime initialized. {"cwd":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions","node_version":"10.16.1"}
[2020-03-26T00:49:19.552Z] [runtime-status] [11930] Disabled runtime features: undefined
[2020-03-26T00:49:19.555Z] [runtime-status] [11930] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:49:19.558Z] [runtime-status] [11930] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:20.059Z] [runtime-status] [11930] Found google-gax at /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/google-gax/build/src/index.js
[2020-03-26T00:49:20.059Z] [runtime-status] [11930] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"},{"name":"google-gax","status":"mocked"}]
[2020-03-26T00:49:20.142Z] [runtime-status] [11930] Checked functions.config() {"config":{}}
[2020-03-26T00:49:20.143Z] [runtime-status] [11930] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:20.146Z] [runtime-status] [11930] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:49:20.147Z] [runtime-status] [11930] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:20.210Z] [runtime-status] [11930] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}}
[2020-03-26T00:49:20.211Z] [runtime-status] [11930] config() parent accessed! {"parentKey":"firebase","parentConfig":{}}
[2020-03-26T00:49:20.214Z] [runtime-status] [11930] initializeApp(DEFAULT) {"databaseURL":"https://test-functions-emulators.firebaseio.com","storageBucket":"test-functions-emulators.appspot.com","projectId":"test-functions-emulators"}
⚠  functions: You're using firebase-functions v3.0.2, please upgrade to firebase-functions v3.3.0 or higher for best results.
✔  functions[helloCallable]: http function initialized (http://localhost:5001/test-functions-emulators/us-central1/helloCallable).
✔  emulators: All emulators started, it is now safe to connect.
[2020-03-26T00:49:20.320Z] [worker-~diagnostic~-23bcde8f-06b0-45b3-b89c-4475523fcd20]: IDLE
[2020-03-26T00:49:29.262Z] File /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/lib/index.tests.js.map changed, reloading triggers
[2020-03-26T00:49:29.263Z] File /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/lib/index.tests.js changed, reloading triggers
[2020-03-26T00:49:29.263Z] File /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/lib/index.js.map changed, reloading triggers
[2020-03-26T00:49:29.263Z] File /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/lib/index.js changed, reloading triggers
[2020-03-26T00:49:30.266Z] [worker-pool] Shutting down IDLE worker (~diagnostic~)
[2020-03-26T00:49:30.266Z] [worker-~diagnostic~-23bcde8f-06b0-45b3-b89c-4475523fcd20]: FINISHING
[2020-03-26T00:49:30.272Z] [worker-pool] addWorker(~diagnostic~)
[2020-03-26T00:49:30.272Z] [worker-pool] Adding worker with key ~diagnostic~, total=2
[2020-03-26T00:49:30.272Z] [worker-pool] submitWork(triggerId=)
[2020-03-26T00:49:30.273Z] [worker-~diagnostic~-3569adb3-a177-48d6-ab5b-2089869751ca]: Assigning socketPath: /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/fire_emu_11957.sock
[2020-03-26T00:49:30.273Z] [worker-~diagnostic~-3569adb3-a177-48d6-ab5b-2089869751ca]: BUSY
[2020-03-26T00:49:30.275Z] [worker-~diagnostic~-23bcde8f-06b0-45b3-b89c-4475523fcd20]: exited
[2020-03-26T00:49:30.275Z] [worker-~diagnostic~-23bcde8f-06b0-45b3-b89c-4475523fcd20]: FINISHED
[2020-03-26T00:49:30.687Z] [runtime-status] [11957] Functions runtime initialized. {"cwd":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions","node_version":"10.16.1"}
[2020-03-26T00:49:30.695Z] [runtime-status] [11957] Disabled runtime features: undefined
[2020-03-26T00:49:30.699Z] [runtime-status] [11957] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:49:30.703Z] [runtime-status] [11957] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:30.907Z] [runtime-status] [11957] Found google-gax at /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/google-gax/build/src/index.js
[2020-03-26T00:49:30.907Z] [runtime-status] [11957] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"},{"name":"google-gax","status":"mocked"}]
[2020-03-26T00:49:30.978Z] [runtime-status] [11957] Checked functions.config() {"config":{}}
[2020-03-26T00:49:30.980Z] [runtime-status] [11957] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:30.988Z] [runtime-status] [11957] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:49:30.990Z] [runtime-status] [11957] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:31.045Z] [runtime-status] [11957] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}}
[2020-03-26T00:49:31.047Z] [runtime-status] [11957] config() parent accessed! {"parentKey":"firebase","parentConfig":{}}
[2020-03-26T00:49:31.049Z] [runtime-status] [11957] initializeApp(DEFAULT) {"databaseURL":"https://test-functions-emulators.firebaseio.com","storageBucket":"test-functions-emulators.appspot.com","projectId":"test-functions-emulators"}
[2020-03-26T00:49:31.122Z] [worker-~diagnostic~-3569adb3-a177-48d6-ab5b-2089869751ca]: IDLE
[2020-03-26T00:49:32.993Z] [work-queue] {"queueLength":1,"workRunningCount":0}
[2020-03-26T00:49:32.993Z] [work-queue] {"queueLength":0,"workRunningCount":1}
[2020-03-26T00:49:32.993Z] Accepted request POST /test-functions-emulators/us-central1/helloCallable --> helloCallable
[2020-03-26T00:49:32.994Z] [worker-pool] Cleaned up workers for ~diagnostic~: 2 --> 1
[2020-03-26T00:49:32.997Z] [worker-pool] addWorker(helloCallable)
[2020-03-26T00:49:32.997Z] [worker-pool] Adding worker with key helloCallable, total=1
[2020-03-26T00:49:32.997Z] [worker-pool] submitWork(triggerId=helloCallable)
[2020-03-26T00:49:32.998Z] [worker-helloCallable-5233df5a-5143-42d3-8972-674c097c6684]: Assigning socketPath: /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/fire_emu_11968.sock
[2020-03-26T00:49:32.998Z] [worker-helloCallable-5233df5a-5143-42d3-8972-674c097c6684]: BUSY
[2020-03-26T00:49:33.284Z] [runtime-status] [11968] Functions runtime initialized. {"cwd":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions","node_version":"10.16.1"}
[2020-03-26T00:49:33.286Z] [runtime-status] [11968] Disabled runtime features: undefined
[2020-03-26T00:49:33.289Z] [runtime-status] [11968] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:49:33.290Z] [runtime-status] [11968] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:33.470Z] [runtime-status] [11968] Found google-gax at /Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/google-gax/build/src/index.js
[2020-03-26T00:49:33.471Z] [runtime-status] [11968] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"},{"name":"google-gax","status":"mocked"}]
[2020-03-26T00:49:33.516Z] [runtime-status] [11968] Checked functions.config() {"config":{}}
[2020-03-26T00:49:33.517Z] [runtime-status] [11968] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:33.521Z] [runtime-status] [11968] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}
[2020-03-26T00:49:33.522Z] [runtime-status] [11968] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.0.2","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-functions/lib/index.js"}
[2020-03-26T00:49:33.548Z] [runtime-status] [11968] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.2.0","resolution":"/Users/ximing/Documents/GitHub/firebase-callable-emulator-test/functions/node_modules/firebase-admin/lib/index.js"}}
[2020-03-26T00:49:33.550Z] [runtime-status] [11968] config() parent accessed! {"parentKey":"firebase","parentConfig":{}}
[2020-03-26T00:49:33.552Z] [runtime-status] [11968] initializeApp(DEFAULT) {"databaseURL":"https://test-functions-emulators.firebaseio.com","storageBucket":"test-functions-emulators.appspot.com","projectId":"test-functions-emulators"}
[2020-03-26T00:49:33.610Z] [runtime-status] [11968] Trigger "helloCallable" has been found, beginning invocation!
i  functions: Beginning execution of "helloCallable"
[2020-03-26T00:49:33.611Z] [runtime-status] [11968] triggerDefinition {"httpsTrigger":{},"labels":{"deployment-callable":"true"},"name":"helloCallable","entryPoint":"helloCallable"}
[2020-03-26T00:49:33.611Z] [runtime-status] [11968] Running helloCallable in mode HTTPS
[2020-03-26T00:49:33.623Z] [runtime-status] [11968] Attempting to listen to socketPath: /var/folders/0b/7t3d40zx5_x9b851b656_ts40000gn/T/fire_emu_11968.sock
[2020-03-26T00:49:33.633Z] [functions] Runtime ready! Sending request!
[2020-03-26T00:49:33.676Z] [runtime-status] [11968] Ephemeral server handling POST request
[2020-03-26T00:49:33.682Z] [runtime-status] [11968] Callable functions auth override {"key":"X-Callable-Context-Auth","value":"{\"uid\":\"alice\",\"token\":{\"uid\":\"alice\",\"email\":\"alice@example.com\",\"iat\":0,\"sub\":\"alice\"}}"}
>  HELLO
[2020-03-26T00:49:33.696Z] [runtime-status] [11968] Ephemeral server survived.
i  functions: Finished "helloCallable" in ~1s
[2020-03-26T00:49:33.698Z] [worker-helloCallable-5233df5a-5143-42d3-8972-674c097c6684]: IDLE
[2020-03-26T00:49:33.699Z] [work-queue] {"queueLength":0,"workRunningCount":0}

I would be also interested in a better solution to this. I wonder why is it a problem to generate a token with the correct signature. I mean how is it possible that we can communicate with the emulated firestore just fine (there is surely some token handling as well), but the token for functions doesn’t work?

@ryanmeisters How do you approach mocking auth in tests? It seems that error is thrown way before the callable function is accessed.

I am surprised that these “basics” are not figured out yet. How are people testing functions?

Ok so the failure happens when the firebase-functions SDK tries to verify the token: https://github.com/firebase/firebase-functions/blob/f3af1759f0bba3c13a0fed9e14682aad76580dc7/src/providers/https.ts#L437

My token looks something like this:

eyJhbGciOiJub25lIiwia2lkIjoiZmFrZWtpZCJ9.eyJ1aWQiOiJhbGljZSIsImVtYWlsIjoiYWxpY2VAZXhhbXBsZS5jb20iLCJpYXQiOjAsInN1YiI6ImFsaWNlIn0=.

Because it’s from the test SDK, it has an invalid signature: image

So I think this is working as intended right now, but we want to make the Functions SDK accept an invalid signature when it’s running in the emulator … not sure how to do that in the best way.

@samtstern will best be able to look at this and help triage.