Skip to content

remote-config: getRemoteConfig() throws uncatchable exception via floating promise #8720

@floooh

Description

@floooh

Operating System

any

Environment (if applicable)

Firefox inside cross-domain iframe

Firebase SDK Version

11.2.0

Firebase SDK Product(s)

Remote-Config

Project Tooling

npm + vite + html/css/js

Detailed Problem Description

When calling the (synchronous) getRemoteConfig() function in an environment where IndexedDB is not available (in this case: Firefox running an Facebook Instant game), the function produces an uncatchable exception coming out of a floating promise):

Uncaught (in promise) FirebaseError: Remote Config: Error thrown when opening storage. Original error: IDBFactory.open: The operation is insecure. (remoteconfig/storage-open).
    FirebaseError https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:67609
    create https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:67631
    openDatabase https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:70787
    openDatabase https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:70764
    Storage https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:70799
    remoteConfigFactory https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:71062
    getOrInitializeService https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:68155
    getImmediate https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:68021
    getRemoteConfig https://apps-478962132555788.apps.fbsbx.com/br-compress-instant-bundle/gzip/2280004395375508/9294355687291998/assets/index-CPrSEjJA.js:70352

The getRemoteConfig() call is inside a try-catch block (which of course doesn't help in this case to actually catch the exception).

A following await ensureInitialized() call then fails with a (this time catchable) exception: FirebaseError: Remote Config: Error thrown when opening storage. Original error: IDBFactory.open: The operation is insecure. (remoteconfig/storage-open).

Same result for await fetchAndActive().

...and any call to one of the getter function then returns the default-source value, but produces a warning message on the console:

@firebase/remote-config: A value was requested for key "aNumber" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.

...is this intended behaviour? E.g. is the idea to not even call any of the Firebase remote-config SDK functions if isSupported() returns false, or is the remote-config SDK supposed to go into some sort of fallback-mode (e.g. always returning the default values) if IndexedDB is not available? In this case it shouldn't produce an uncatchable exception since this just produces noise in our Sentry logs :)

Steps and code to reproduce issue

Just call getRemoteConfig in a runtime environment where IndexedDB is not available.

It's expected that this doesn't produce a floating promise which throws an uncatchable exception.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions