Skip to content

HTTPS Callable context.auth is null after updating to latest packages (-tools 11.16) #5210

Closed
@brianmhunt

Description

@brianmhunt

[REQUIRED] Environment info

$ npx firebase --version
11.16.0

firebase-tools:

Platform:

OS X 12.6

[REQUIRED] Test case

Run a trivial HTTPS callable function in the Functions Emulator. It does not have context.auth, as would be expected.

[REQUIRED] Steps to reproduce

Listener:

  export ping = functions.https.onCall(async (params, context) => {
    if (!context.auth) { throw new Error("Where's the auth?") }
    console.log("Have auth", context.auth)
  })

Call with functions.httpsCallable('ping')(),

[REQUIRED] Expected behavior

context.auth have the expected credentials and output and emulator console show "Have auth" .

[REQUIRED] Actual behavior

Emulator shows "Where's the auth?"

Related:

Packages / upgrade

This started occurring when we updated some packages, notably:

  • firebase-tools 11.6 => 11.16
  • firebase 8.4 => 9.13
  • firebase-admin 11.0 => 11.3
  • firebase-functions 3.22 => 4.0.2

JWT Header

If we print the headers the authentication header has a proper (unsigned) Bearer token e.g. from jwt.io

CleanShot 2022-11-04 at 12 35 21@2x

Deploy vs emulator

The function works as expected when deployed, suggesting this is an emulator problem.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions