firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Functions v2 authType is 'unknown' when using emulator

Open Bindslev opened this issue 7 months ago • 13 comments

Related issues

[REQUIRED] Version info

node:

v18.8.0

firebase-functions: firebase function: v2

firebase-tools:

firebase version: 13.12.0

firebase-admin:

[REQUIRED] Test case

  1. Sign up to firebase auth / firestore / functions
  2. Create a login page
  3. Create a function that is triggered on a firestore collection write/update/delete
  4. Use "onDocumentUpdatedWithAuthContext" or any of the other methods with the AuthContext
  5. Notice that event.authType is unknown when developing locally using the firebase emulator after the use is logged in and authenticated

[REQUIRED] Steps to reproduce

I haven't found any documentation about this not working in the emulator, so I suppose it happens for everybody?

[REQUIRED] Expected behavior

I was expecting for the authType to not be unknown, and be able to retrieve the authenticated users ID using event.authId

[REQUIRED] Actual behavior

I get this:

authType: 'unknown', authId: '[email protected]'

Were you able to successfully deploy your functions?

Yes

Bindslev avatar Jul 03 '24 11:07 Bindslev