Skip to content

fix(remote_config): deliver onConfigUpdated errors on Android and iOS as FirebaseException with stable codes - #18840

Draft
Lyokone wants to merge 4 commits into
mainfrom
fix/remote-config-android-error-thread
Draft

Lyokone wants to merge 4 commits into
mainfrom
fix/remote-config-android-error-thread

Conversation

@Lyokone

@Lyokone Lyokone commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Realtime errors never reached onConfigUpdated listeners on Android or iOS. Now every platform delivers them as a FirebaseException with a stable code.

  • Android: the SDK reports errors from a background thread, and sending them to Dart from there throws, so they were lost. They are now sent from the main thread.
  • iOS: errors were only printed. They are now sent to Dart.
  • Web: errors were raw JS objects. They are now FirebaseExceptions.

Codes: config-update-stream-error, config-update-message-invalid, config-update-not-fetched, config-update-unavailable and unknown. The stream stays open after an error.

Behaviour change: on Android and iOS, onConfigUpdated now emits errors. Listen with onError, otherwise the error is uncaught (Crashlytics records it as a fatal crash). The docs and the example now pass onError.

Tests

  • Dart (method_channel_firebase_remote_config_test.dart): the stream emits a FirebaseException for each code, stays open after an error, and reports an error without details as unknown.
  • Web (internals_test.dart): the JS SDK's realtime codes map to the codes above.
  • Android JUnit (FirebaseRemoteConfigPluginTest): onError_isForwardedToDartOnTheMainThread fails on main. Other tests check every code, the HTTP status in the message, and the listener onListen registers.
  • iOS: checked by hand on a simulator. CI has no way to make the realtime backend fail.

Related Issues

May explain part of #17898.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • No, this is not a breaking change.

Apps that listen without onError will now see realtime errors as uncaught errors on Android and iOS, as web already did. On web, these errors are now FirebaseExceptions instead of raw JS objects.

@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@Lyokone Lyokone changed the title fix(remote_config): deliver onConfigUpdated errors to Dart on Android and iOS fix(remote_config): deliver onConfigUpdated errors on Android and iOS as FirebaseException with stable codes Oct 21, 2026
… and iOS

On Android the realtime listener called EventSink.error from the SDK's
background executor. FlutterJNI throws off the main thread, so the error
never reached Dart and the exception was swallowed by the SDK's task
continuation. Post it to the main thread, as onUpdate already does.

On iOS the error was only printed. Forward it to the stream as a
FlutterError with the same code as Android, matching web, which already
adds realtime errors to the stream.
…n with stable codes

onConfigUpdated now reports realtime connection errors on Android and
iOS; listen with onError. An error with no handler is reported as
uncaught, which Crashlytics records as a fatal crash. The stream stays
open after an error, and the SDKs keep retrying, so the same error can
be reported again.

Every platform now delivers these errors as
FirebaseException(plugin: 'firebase_remote_config') with one of these
codes: config-update-stream-error, config-update-message-invalid,
config-update-not-fetched, config-update-unavailable or unknown.
Before, Android and iOS sent a PlatformException with no details, which
lost the native code, and web sent the raw JS FirebaseError.

- Android and iOS put the code and message in the error details, and
  the method channel stream converts them with the package's existing
  convertPlatformException.
- On iOS, the update error domain is checked first. Its codes overlap
  with RemoteConfigError (notFetched and throttled are both 8002). A
  failed fetch of an announced update keeps the codes fetch uses.
- On web, onConfigUpdated goes through convertWebExceptions, which now
  maps the JS SDK's realtime codes to the same names.

The onConfigUpdated dartdoc lists the codes. The docs snippet and the
example now pass onError.
@Lyokone
Lyokone force-pushed the fix/remote-config-android-error-thread branch from a836e4b to 89accf0 Compare October 29, 2026 13:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant