Auth emulator: send metadata timestamps as int instead of string #7310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In the auth emulator sign in blocking function, send
metadata.last_sign_in_time
andmetadata.creation_time
as numbers and not strings so that firebase-functions can handle them.This is already implemented for calling Cloud Functions associated with other auth events:
firebase-tools/src/emulator/auth/cloudFunctions.ts
Lines 77 to 84 in d01da70
But it's missing for the sign in blocking function call.
This results in sending string timestamps in the metadata:
This is unsupported by the firebase-functions framework on the other side, that expects a number: https://github.com/firebase/firebase-functions/blob/9c818713db511895a33378859ab1b9f2eef99179/src/common/providers/identity.ts#L363-L366
In particular, the way it uses it: https://github.com/firebase/firebase-functions/blob/9c818713db511895a33378859ab1b9f2eef99179/src/common/providers/identity.ts#L516-L521
This results in e.g.:
By sending a number, we make sure that the receiving end can process the timestamps.
Scenarios Tested