prescottprue/cypress-firebase

bug(firestore): nested Timestamp value not persisting

yellowee opened this issue · 3 comments

Describe the bug

I have a problem inserting a timestamp that is nested deep in the structure. Is the library serializing objects before the insert please?

To Reproduce
Steps to reproduce the behavior:

Create an object as follows:

const time = Timestamp.fromDate(new Date())
cy.callFirestore('set', 'test/foo', { elo: [{ time }] })

Expected behavior/code
I would expect the time keey to be a timestamp value, but in fact it is a map with nanoseconds and secons

Additional Context/Screenshots

image

Just want to confirm - was this with v2.2.3? There was a fix in that version for nested timestamp values. There is a test confirming that, so if things still aren't working we will want to adjust the test to cover that

Yes there is serialization because the request has to go from the browser to the NodeJS side so that firebase-admin can be used to call the DB (admin access instead of user). Part of that process is marking timestamps in a way that they can be parsed again on the node side

@yellowee I just ran the code you provided in the typescript example with v2.2.3 and it is working as expected:
image

Could you give the newest version a try? Let me know either way, if that doesn't fix it we can reopen

Hey, the problem is indeed resolved by the newest version. Thank you!