firebase / firebase/firebase-tools

user.providerDara returned by functions.auth.user().onCreate on emulator is not consistent with Cloud function in cloud

Open
#4,880 1 comment 0 reactions 1 assignee Assigned to @christhompsongoogle View on GitHub
emulators: auth type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

When I trigger `functions.auth.user().onCreate` the `user.providerDara` param returned is different in Emulator and Cloud.
- On emulator the user.providerData looks following doc:
{"providerId":"phone","phoneNumber":"+5521983487233","rawId":"+5521983487233"}
- And same record on cloud looks:
{"providerId":"phone", "uid":"+5521983487233"}

I've logged responses above w/ following cf code:

```ts
export const onAuthUserCreate = functions.auth.user().onCreate(
(
user: admin.auth.UserRecord,
context: EventContext
): Promise {
console.log(user.providerData);
return Promise.resolve();
}
);
```

This inconsistency prevent testing locally when providerData is used on cf.

Tested on firebase-tools@9.16.0 and firebase-functions@3.15.5

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.