firebase / firebase/firebase-functions

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

Open
#1,889 6 comments 0 reactions 0 assignees View on GitHub
bug reproduced
Dominant language
TypeScript
Stars
1.1k
Forks
232
Avg merge
20h 46m
Merged PRs (30d)
15

Description

### Related issues

https://github.com/firebase/firebase-functions/pull/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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.