React-native-firebase: Location of firebase.json file

Created on 7 Jul 2020  路  9Comments  路  Source: invertase/react-native-firebase


Issue



Many parts of the library rely on firebase.json for loading boot-time configs, e.g. https://rnfirebase.io/in-app-messaging/usage#disable-collection-of-data, https://rnfirebase.io/perf/usage#disable-auto-initialization etc. AFAICT the doc always says that the file should be placed directly under <project_root>. However, it seems that on iOS the build script does a recursive search of this file under all subdirectories of <project_root>: https://github.com/invertase/react-native-firebase/blob/master/packages/app/ios_config.sh#L65-L75

Why is this problem? Well, if you're using this library, chances are you're also using other firebase services. In my case, I have a directory <project_root>/firebase containing files that are intended to be deployed to firebase hosting. Incidentally the firebase CLI also requires a hard-coded firebase.json config file, which is naturally placed under <projectd_root>/firebase/firebase.json in my case. As a result, this file is always picked up first by FNFB's build script instead of <project_root>/firebase.json due to lexicographical order.


Project Files






iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:

# N/A
#### `AppDelegate.m`:
// N/A


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:

// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->


Environment

Click To Expand

**`react-native info` output:**

 OUTPUT GOES HERE
- **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N` & `VERSION` - **Are you using `Expo`?** - `Y` & `SDK VERSION`




Build Error ApCore Needs Review 馃搶 pin

Most helpful comment

This is still an open issue. Please don't close it yet.

All 9 comments

...and people wanted me to add non-deterministic file searching to the jetifier 馃槄

Actually to make matters worse, for Android, the build script searches recursively upward: https://github.com/invertase/react-native-firebase/blob/master/packages/app/android/firebase-json.gradle#L10-L17 which means the iOS and Android build might end up picking up a different version of firebase.json :(

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

This is still an open issue. Please don't close it yet.

Seems like as a stopgap we should advise in the docs to create a firebase.json empty at minimum, to stop this from happening - that's a PR we could merge immediately, and I recall that if it's malformed then plist injection fails, so the JSON should both exist and be verified syntactically until the ios build step explicitly fails on malformed json and/or recursive searching isn't done

SGTM

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

This is still an open issue. Please don't close it yet.

Indeed - I see it every time I scan the queue but it hasn't made it high enough to get a time slice yet sadly. I'll pin it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rgoldiez picture rgoldiez  路  3Comments

callmejm picture callmejm  路  3Comments

jonaseck2 picture jonaseck2  路  3Comments

csumrell picture csumrell  路  3Comments

alizahid picture alizahid  路  3Comments