Skip to content

Conversation

@mikehardy
Copy link
Collaborator

Description

Apparently the userInfo property may be missing entirely on NativeError, but this wasn't safely handled in NativeFirebaseError

  • Change the typescript def of NativeError to recognize that userInfo property was optional / possibly-undefined
  • Repaired the constructor to correspond to the new definition
  • Added a test to make sure that NativeError.userInfo === undefined case was handled

Related issues

Release Summary

fix release

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

I added a unit test to probe the condition as observed in reality, and it did fail prior to the changes here

I made the changes here and re-ran the test, and it passed

While running yarn tests:jest I noticed some deprecation warnings in functions jest tests and repaired those in a separate commit since I was in the unit testing area...


Think react-native-firebase is great? Please consider supporting the project with any of the below:

previously a missing NativeError.userInfo would crash
the constructor of NativeFirebaseError as it was expected to be defined

with this change we will tolerate a completely missing userInfo property
@vercel
Copy link

vercel bot commented Jan 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
react-native-firebase Ready Ready Preview, Comment Jan 17, 2026 6:20pm

Request Review

@mikehardy mikehardy merged commit ba55012 into main Jan 19, 2026
20 of 21 checks passed
@mikehardy mikehardy deleted the @mikehardy/native-error-missing-userinfo branch January 19, 2026 10:53
@mikehardy mikehardy removed the Workflow: Needs Review Pending feedback or review from a maintainer. label Jan 20, 2026
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.

[🐛] NativeFirebaseError constructor crashes on real-world input: Cannot read property 'code' of undefined 🔥

3 participants