-
Notifications
You must be signed in to change notification settings - Fork 895
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
Different versions of Firebase in one bundle break the ability to log Timestamp to Firestore #8032
Comments
…digging into this further, it seems that there might be two instances of |
// node_modules/@firebase/firestore/dist/index.esm2017.js
class at {
/**
* Creates a new timestamp. |
It looks like an unrelated package had a dependency on an old version of firebase (9.6.1). Not sure why different parts of my project were resolving different versions of Firebase (and it's already later than I wanted to be working on this tonight), but changing the package.json in the unrelated dependency does seem to fix the issue. |
Alright, I think this is what happened:
|
Oh that's great. Thanks for getting back to us with the root problem and the fix! I'm glad you got it figured out. |
Operating System
MacOS 14.3.1 (23D60)
Browser Version
121.0.6167.184 (Official Build) (arm64)
Firebase SDK Version
10.1.0
Firebase SDK Product:
Firestore
Describe your project's tooling
[email protected]
[email protected] ([email protected], [email protected])
Describe the problem
I'm trying to include a timestamp in a log. It works locally, but I see this error when I deploy:
Digging into the bundled JS, I realized that Vite (via esbuild) is mangling my names, and that
pr
is the value it chose forTimestamp
. It doesn't appear that Vite allows you to prevent names from being mangled with esbuild, so I tried changing toterser
.terser
still mangled the name, but it choseat
, so now the error is:Steps and code to reproduce issue
bundled with
vite build
Expected result
Firestore should be resilient to common practices like minification.
I can understand the ambiguity around whether
{seconds, nanoseconds}
should be treated as aTimestamp
or an object literal; however, there are solutions. The most correct one is probably to add a special property like"__firebaseBrand__": "Timestamp"
and check it to determine how to store/present a value. Alternatively, you could checkvalue.toString().startsWith('Timestamp')
, since that class has a custom implementation oftoString
.The text was updated successfully, but these errors were encountered: