Skip to content

V2 RTDB functions *suddenly* trigger with authType=unknown and uid=null #1889

@bezysoftware

Description

@bezysoftware

Related issues

#1770

[REQUIRED] Version info

"firebase-admin": "^13.8.0",
"firebase-functions": "^7.2.5",
"firebase-tools": 15.1.0

node: 22

export const writeTransactionChangeV2 = onValueWritten(
  { ref: '/transactions/{groupId}/{entityId}', ...MAX_MEMORY_TIMEOUT_OPTIONS },
  event => {
    logger.info('AUTH-TEST v2', {
      authId: event.authId ?? null,
      authType: event.authType ?? null,
      instance: event.instance,
      firebaseDatabaseHost: event.firebaseDatabaseHost,
      params: event.params,
      eventId: event.id,
    });
  });

export const writeTransactionChangeV1 = functionsV1
  .database
  .ref('/transactions/{groupId}/{entityId}')
  .onWrite((_change, context) => {
    logger.info('AUTH-TEST v1', {
      auth: context.auth ?? null,
      authType: context.authType ?? null,
      params: context.params,
      eventType: context.eventType,
      eventId: context.eventId,
    });
  });

[REQUIRED] Steps to reproduce

Client app (user authenticated) writes to /transactions/{groupId}/{entityId}.

[REQUIRED] Expected behavior

Logs should show user's uid & authType 'user' for both v1 AND v2 functions

[REQUIRED] Actual behavior

V1 is correct while V2 has unknown authType:

V1 (correct uid)

Image

V2 (uid missing, unknown auth type)

Image

Were you able to successfully deploy your functions?

No issues with deploy

Notes

This used to work. We took months slowly migrating all our functions to v2 and tested this and we new THIS WORKED. But somewhere between May6 and May15 this broke - we suddenly started receiving unknown authType and null uid.

We have 2 Firebase projects (sandbox and live) and only one of them is affected. Both have the same packages, same node, same functions, no functional differences we're aware of. Again, we took migration seriously and this WORKED.

I can share both project IDs if needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions