firebase / firebase/firebase-tools

Context passed to emulated auth.onCreate is not a valid EventContext

Open
#2,752 5 comments 0 reactions 1 assignee Claimed by @abeisgoat View on GitHub
emulator-suite emulators: auth type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:8.14.1**

**Platform:macOS**

### [REQUIRED] Test case

```
functions
.auth.user()
.onCreate(userRecord, context) => {
console.log(context)
}
```

### [REQUIRED] Steps to reproduce

Include the above snippet as a cloud function and create a new user. You'll see that the `context` is not a valid `EventContext`.

### [REQUIRED] Expected behavior

I would expect `context` to contain all properties specified in `EventContext`.

### [REQUIRED] Actual behavior

`context` is missing e.g. the `eventId` and the `timestamp`. See the log output:
```
{
eventType: 'google.firebase.auth.user.create',
resource: { service: 'firebaseauth.googleapis.com', name: undefined },
params: {}
}
```

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.