Skip to content

Add a stopgap idb replacement #6061

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

Merged
merged 4 commits into from
Mar 14, 2022
Merged

Add a stopgap idb replacement #6061

merged 4 commits into from
Mar 14, 2022

Conversation

hsubox76
Copy link
Contributor

@hsubox76 hsubox76 commented Mar 9, 2022

Replace idb dependency with a temporary set of methods in @firebase/util. This is to address an increasing amount of mostly Node ESM module related problems caused by depending on an old version of idb. Upgrading to idb 7+ may also fix many of these problems but would require dropping IE support.

In the interest of reducing the amount of surface area for error, I have only filled in the minimum idb methods and properties currently being used by our consuming libraries. We are planning on extracting a more fully featured idb promise wrapper library from Firestore in the near future.

Although these methods won't work in Node, I am exporting them from the @firebase/util Node entry point also, otherwise if an app compiles in Node mode (like an SSR app), it'll break on build when the packages try to import these methods. Errors can be avoided by using isSupported() to prevent initialization of relevant products.

@changeset-bot
Copy link

changeset-bot bot commented Mar 9, 2022

🦋 Changeset detected

Latest commit: 89dd970

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
@firebase/app Patch
@firebase/installations Patch
@firebase/installations-compat Patch
@firebase/messaging Patch
@firebase/util Minor
@firebase/analytics Patch
@firebase/app-check Patch
@firebase/app-compat Patch
@firebase/auth Patch
@firebase/database Patch
firebase Patch
@firebase/firestore Patch
@firebase/functions Patch
@firebase/performance Patch
@firebase/remote-config Patch
@firebase/storage Patch
@firebase/messaging-compat Patch
@firebase/analytics-compat Patch
@firebase/app-check-compat Patch
@firebase/auth-compat Patch
@firebase/component Patch
@firebase/database-compat Patch
@firebase/database-types Patch
@firebase/firestore-compat Patch
@firebase/functions-compat Patch
@firebase/performance-compat Patch
@firebase/remote-config-compat Patch
@firebase/storage-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hsubox76 hsubox76 requested a review from jamesdaniels March 9, 2022 00:47
@hsubox76 hsubox76 requested a review from egilmorez as a code owner March 9, 2022 00:50
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 9, 2022

Size Report 1

Affected Products

  • @firebase/app

    TypeBase (09e6243)Merge (5e58064)Diff
    browser13.9 kB13.9 kB-28 B (-0.2%)
    esm518.8 kB18.7 kB-30 B (-0.2%)
    main19.7 kB19.7 kB-59 B (-0.3%)
    module13.9 kB13.9 kB-28 B (-0.2%)
  • @firebase/installations

    TypeBase (09e6243)Merge (5e58064)Diff
    browser17.3 kB17.2 kB-28 B (-0.2%)
    esm522.3 kB22.3 kB-30 B (-0.1%)
    main23.1 kB23.1 kB-59 B (-0.3%)
    module17.3 kB17.2 kB-28 B (-0.2%)
  • @firebase/messaging

    TypeBase (09e6243)Merge (5e58064)Diff
    browser20.8 kB20.8 kB+20 B (+0.1%)
    esm526.1 kB26.2 kB+17 B (+0.1%)
    main26.8 kB26.8 kB-8 B (-0.0%)
    module20.8 kB20.8 kB+20 B (+0.1%)
  • @firebase/messaging-sw

    TypeBase (09e6243)Merge (5e58064)Diff
    main29.6 kB29.6 kB-8 B (-0.0%)
    module22.8 kB22.8 kB+20 B (+0.1%)
  • @firebase/util

    TypeBase (09e6243)Merge (5e58064)Diff
    browser20.5 kB23.4 kB+2.86 kB (+13.9%)
    esm521.9 kB25.5 kB+3.65 kB (+16.7%)
    main26.7 kB30.5 kB+3.82 kB (+14.3%)
    module20.5 kB23.4 kB+2.86 kB (+13.9%)
  • bundle

    43 size changes

    TypeBase (09e6243)Merge (5e58064)Diff
    analytics (logEvent)41.8 kB39.7 kB-2.06 kB (-4.9%)
    app-check (CustomProvider)35.7 kB33.6 kB-2.05 kB (-5.8%)
    app-check (ReCaptchaEnterpriseProvider)37.9 kB35.8 kB-2.05 kB (-5.4%)
    app-check (ReCaptchaV3Provider)37.8 kB35.8 kB-2.05 kB (-5.4%)
    auth (Anonymous)65.3 kB63.2 kB-2.06 kB (-3.2%)
    auth (EmailAndPassword)69.3 kB67.3 kB-2.06 kB (-3.0%)
    auth (GoogleFBTwitterGitHubPopup)89.1 kB87.1 kB-2.06 kB (-2.3%)
    auth (GooglePopup)88.9 kB86.8 kB-2.06 kB (-2.3%)
    auth (GoogleRedirect)89.1 kB87.0 kB-2.06 kB (-2.3%)
    auth (Phone)75.3 kB73.3 kB-2.06 kB (-2.7%)
    database (Append to a list of data)146 kB143 kB-2.10 kB (-1.4%)
    database (Filtering data)144 kB142 kB-2.10 kB (-1.5%)
    database (Listen for child events)160 kB158 kB-2.10 kB (-1.3%)
    database (Listen for value events + Detach listeners)160 kB158 kB-2.10 kB (-1.3%)
    database (Listen for value events)160 kB158 kB-2.10 kB (-1.3%)
    database (Read data once)152 kB150 kB-2.10 kB (-1.4%)
    database (Save data as transactions)162 kB160 kB-2.10 kB (-1.3%)
    database (Sort data)146 kB144 kB-2.10 kB (-1.4%)
    database (Write data)145 kB143 kB-2.10 kB (-1.4%)
    firestore (Persistence)261 kB259 kB-2.06 kB (-0.8%)
    firestore (Query Cursors)203 kB201 kB-2.05 kB (-1.0%)
    firestore (Query)204 kB202 kB-2.05 kB (-1.0%)
    firestore (Read data once)193 kB191 kB-2.05 kB (-1.1%)
    firestore (Realtime updates)195 kB193 kB-2.05 kB (-1.1%)
    firestore (Transaction)178 kB176 kB-2.05 kB (-1.2%)
    firestore (Write data)177 kB175 kB-2.05 kB (-1.2%)
    firestore-lite (Query Cursors)68.3 kB66.2 kB-2.05 kB (-3.0%)
    firestore-lite (Query)71.3 kB69.3 kB-2.05 kB (-2.9%)
    firestore-lite (Read data once)55.8 kB53.7 kB-2.05 kB (-3.7%)
    firestore-lite (Transaction)73.1 kB71.1 kB-2.05 kB (-2.8%)
    firestore-lite (Write data)58.6 kB56.6 kB-2.05 kB (-3.5%)
    functions (call)29.6 kB27.5 kB-2.05 kB (-6.9%)
    messaging (send + receive)44.9 kB43.0 kB-1.86 kB (-4.2%)
    performance (trace)49.4 kB47.4 kB-2.06 kB (-4.2%)
    remote-config (getAndFetch)44.1 kB42.1 kB-2.06 kB (-4.7%)
    storage (getBytes)37.9 kB35.9 kB-2.05 kB (-5.4%)
    storage (getDownloadURL)40.0 kB37.9 kB-2.05 kB (-5.1%)
    storage (getMetadata)39.4 kB37.4 kB-2.05 kB (-5.2%)
    storage (list + listAll)38.9 kB36.8 kB-2.05 kB (-5.3%)
    storage (updateMetadata)39.7 kB37.7 kB-2.05 kB (-5.2%)
    storage (uploadBytes)44.3 kB42.2 kB-2.05 kB (-4.6%)
    storage (uploadBytesResumable)53.7 kB51.6 kB-2.05 kB (-3.8%)
    storage (uploadString)44.5 kB42.4 kB-2.05 kB (-4.6%)

  • firebase

    15 size changes

    TypeBase (09e6243)Merge (5e58064)Diff
    firebase-analytics-compat.js26.0 kB24.1 kB-1.91 kB (-7.3%)
    firebase-analytics.js107 kB104 kB-2.93 kB (-2.7%)
    firebase-app-compat.js28.2 kB26.3 kB-1.91 kB (-6.8%)
    firebase-app.js84.2 kB81.2 kB-2.93 kB (-3.5%)
    firebase-auth-react-native.js486 kB491 kB+4.80 kB (+1.0%)
    firebase-compat.js777 kB775 kB-1.80 kB (-0.2%)
    firebase-messaging-compat.js38.0 kB36.2 kB-1.77 kB (-4.7%)
    firebase-messaging-sw.js102 kB99.9 kB-2.36 kB (-2.3%)
    firebase-messaging.js101 kB98.5 kB-2.36 kB (-2.3%)
    firebase-performance-compat.js30.8 kB28.9 kB-1.89 kB (-6.1%)
    firebase-performance-standalone-compat.es2017.js87.5 kB86.1 kB-1.34 kB (-1.5%)
    firebase-performance-standalone-compat.js65.7 kB64.1 kB-1.60 kB (-2.4%)
    firebase-performance.js119 kB116 kB-2.93 kB (-2.5%)
    firebase-remote-config-compat.js27.5 kB25.6 kB-1.90 kB (-6.9%)
    firebase-remote-config.js109 kB106 kB-2.93 kB (-2.7%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/TAq4IAerpU.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 9, 2022

Size Analysis Report 1

This report is too large (151,151 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/UH3d4CU3id.html

@ewanmay
Copy link

ewanmay commented Mar 10, 2022

Hey folks, loyal firebase user here. Just wondering if we have an ETA on merging? Not trying to rush you at all but a few of us can't build our code right now. We are relying on many of the features in V9 that make it difficult to roll back.

@everbliss7
Copy link

Same here, we have stopped working on our current project until the fix.

@Ephrem-Adugna
Copy link

Also kinda helpless without a fix.

@edi
Copy link

edi commented Mar 12, 2022

Waiting :)

@quckslvr
Copy link

quckslvr commented Mar 13, 2022

Hi everyone, while waiting for the merge I tried the 9.6.3 version and it works.
So as a workaround you can install this version while waiting for the approval :D

Copy link
Member

@zwu52 zwu52 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hsubox76
Copy link
Contributor Author

If we get approvals this should go out in Thursday's release (March 17).

@ewanmay
Copy link

ewanmay commented Mar 14, 2022

Hi everyone, while waiting for the merge I tried the 9.6.3 version and it works. So as a workaround you can install this version while waiting for the approval :D

No such luck for me

@allspain allspain assigned hsubox76 and unassigned allspain Mar 14, 2022
@hsubox76 hsubox76 merged commit 2d672ce into master Mar 14, 2022
@Santoshah
Copy link

please release this stopgap for version 8 as well.

@google-oss-bot google-oss-bot mentioned this pull request Mar 16, 2022
@JamesOwen7
Copy link

Hi there, new firebase user and I'm encountering the error "Can't find variable: IDBIndex" error. Is this what is being discussed on here...?

@ewanmay
Copy link

ewanmay commented Mar 17, 2022

@JamesOwen7 Yes

@thegirlyoucallryan
Copy link

Has this been fixed? I tried downgrading to older packages but nothing is working for me.

@ewanmay
Copy link

ewanmay commented Mar 17, 2022

Can confirm this is fixed in production

Use version 9.6.9 (The latest as of this post) and you should be all good to go!

@edi
Copy link

edi commented Mar 17, 2022

Yes, all working fine. Now can someone please look into #5848 ?

It’s really affecting everyone who uses firebase storage in RN ..

@Santoshah
Copy link

Is this also released for firebase version 8 ?

@wortkotze
Copy link

Sry I receive still the following error:
[Unhandled promise rejection: FirebaseError: Remote Config: Indexed DB is not supported by current browser (remoteconfig/indexed-db-unavailable).]
in Version 9.6.9
has the fix been applied there?

thx

@TheBigOx
Copy link

Sry I receive still the following error: [Unhandled promise rejection: FirebaseError: Remote Config: Indexed DB is not supported by current browser (remoteconfig/indexed-db-unavailable).] in Version 9.6.9 has the fix been applied there?

thx

I also get the issue on version 9.6.9 and 9.6.10

@firebase firebase locked and limited conversation to collaborators Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.