Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent documentation about creationTime #3093

Closed
smousa opened this issue Jan 28, 2021 · 7 comments · Fixed by #4491
Closed

Inconsistent documentation about creationTime #3093

smousa opened this issue Jan 28, 2021 · 7 comments · Fixed by #4491

Comments

@smousa
Copy link

smousa commented Jan 28, 2021

Maybe I am looking at an old version of the documentation and I don't know it yet.

The firestore documentation says that the creationTime on the auth.UserMetadata object should be a formatted UTC string of the date.

https://firebase.google.com/docs/reference/admin/node/admin.auth.UserMetadata#creationtime

And if you look at the definition for the lastRefreshTime it elaborates on a UTC string as "eg 'Sat, 03 Feb 2001 04:05:06 GMT'"

However, when I verify this by retrieving the creationTime from a functions trigger running on my emulator, the resulting value is a string of the millisecond timestamp.

Is that expected? Is that the same behavior I should expect when running in a live environment? I haven't tried it live yet, but I will update this ticket if I notice an inconsistency.

What I am ultimately asking for is clarification within the documentation itself, because it is confusing.

Thanks!

@sam-gc
Copy link
Contributor

sam-gc commented Jan 29, 2021

Hi, thanks for reaching out. I believe this is unrelated to the emulator UI. I'm going to transfer this issue over to the emulator suite

@sam-gc sam-gc transferred this issue from firebase/firebase-tools-ui Jan 29, 2021
@smousa
Copy link
Author

smousa commented Jan 29, 2021

update: I have verified that the live version of firebase auth presents the creationTime as 2021-01-29T02:02:11Z
So it looks like you have divergent behaviors between the emulator and the live system.

@yuchenshi
Copy link
Member

Would you mind posting some code about how you retrieved the user and creationTime? We'd be glad to take a deeper look.

@kmcnellis kmcnellis added the Needs: Author Feedback Issues awaiting author feedback label Feb 2, 2021
@smousa
Copy link
Author

smousa commented Feb 2, 2021

Run this cloud function in the emulator and against a real system and you will see the difference

import * as functions from 'firebase-functions';

export default functions.auth.user().onDelete(async (user) => {
  functions.logger.info(user.metadata.creationTime, typeof user.metadata.creationTime)
})

@google-oss-bot google-oss-bot added Needs: Attention and removed Needs: Author Feedback Issues awaiting author feedback labels Feb 2, 2021
@mdesoto
Copy link

mdesoto commented Apr 23, 2022

Can confirm that this is still an issue.

@yuchenshi
Copy link
Member

Hi all, thanks for the input. It is now clear that the problem is with the Firebase Auth emulator and I'll track this as a bug. PRs welcome too. (Previously, I got a bit confused and did not triage this in time since OP mentions "firestore" but this has nothing to do with Firestore. My apologies.)

@dsl101
Copy link

dsl101 commented Oct 21, 2022

I posted a bug report to firebase-functions, as it showed up on upgrading, but I think it might be related to this one. I have an authUserOnCreate() trigger, that uses creationTime, and this is being passed in as undefined since firebase-tools 11.2.0 (I just ran the tests from 10.9.2 for each released tag, and 11.2.0 is where the error first shows up. Might it be related to this commit? See line 80 of src/emulator/auth/state.ts that was removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants