-
Notifications
You must be signed in to change notification settings - Fork 893
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
IDBIndex is not defined
runtime exception in Node.js when importing ESM
#6042
Comments
IDBIndex is not defined
runtime exception in Node.js when importing modulesIDBIndex is not defined
runtime exception in Node.js when importing ESM
There have also been four (so far) questions with this error on Stack Overflow in the past few days: https://stackoverflow.com/search?tab=newest&q=%5bfirebase%5d%20IDBIndex. Can we confirm whether this is an issue in the latest SDK release? |
@puf this started happening for us when we upgraded from firebase 9.6.7 to 9.6.8 today. For now we "fixed" it by setting 9.6.7 as our version to use. |
@arendjantetteroo might be a different root cause if downgrading fixed, what firebase modules are you importing? |
@jamesdaniels We currently only use the auth module |
Can confirm that I'm also running into this issue. The known source of this error is importing analytics on a non-web environment, but it appears to now be triggered upon import of any module. I'm also running into this issue after downgrading, so either I am having caching issues or something changed on the backend of firebase causing the running of |
Thanks for chiming in. We've confirmed that this issue (and the same root cause) has spread to other products in recent releases, a fix is in play #6061. |
any updates on this? |
Great news! |
Yes, I tried this morning and it's all working again. Thanks! |
Got another one after the above issue |
I am also experiencing angular/angularfire#3181 If anyone has a workaround I would love to know! We had to disable our SSR for the time being. |
[REQUIRED] Describe your environment
Including analytics, remote config, performance monitoring, FCM, or AppCheck in your server bundle while targeting ESM leads to a runtime failure
IDBIndex is not defined
; even if the code is not executed or guarded by platform checks / isSupported.This is a problem as frameworks that build for the server may target ESM in Node.js. Angular for instance started doing this in 13.1+ by default.
This significantly impacts AngularFire, since we check
isSupported
from Analytics, RC, and Messaging in the main bundle due to how Angular's Dependency Injection operates. Apps using our library can't upgrade to the latest versions of Angular.The root cause looks to be that the older version of the
idb
package (dependency of@firebase/installations
) is not using the exports field in its package.json; it expects Node.js to load the CJS. Their ESM blindly expects IndexDB classes to exist. As I understand we can't simply upgradeidb
(assuming they've fixed this in a recent version) since they dropped support for Internet Explorer in its entirety.As discussed this may turn into a whack a mole situation, as this exception may just be the first of many encountered. Other packages may be setup incorrectly to support modules in Node.js. I will be exploring further.
Context
angular/angularfire#3113
angular/angularfire#3102
angular/universal#2475
nrwl/nx#8767
The text was updated successfully, but these errors were encountered: