react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

feat(database): add support for get() method

Open mikehardy opened this issue 1 year ago • 13 comments

Description

Supercedes #7149 - I don't have write access to that tree and it needs some lint fixes to merge, but otherwise is ✅ - all credit to @nahuelb

Related issues

Fixes #4411

Release Summary

squash with PR title as commit

Checklist

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

Test Plan

Comes complete with e2e tests! 🤟


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

mikehardy avatar Jun 05 '23 17:06 mikehardy

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ❌ Failed (Inspect) Jun 5, 2023 5:41pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
react-native-firebase-next ⬜️ Ignored (Inspect) Jun 5, 2023 5:41pm

vercel[bot] avatar Jun 05 '23 17:06 vercel[bot]

The android CI failure appears to be a real failure related to the PR

https://github.com/invertase/react-native-firebase/actions/runs/5180171278/jobs/9333995832?pr=7165#step:19:1331


18:13:36.358 detox[43053] WARN:  at e2e/init.js:41:15 
 ⚠️ A test failed:
18:13:36.358 detox[43053] WARN:  at e2e/init.js:42:15 
 ️   ->  errors if permission denied
18:13:36.358 detox[43053] WARN:  at e2e/init.js:49:13 
 ️   ->  Retrying in 5 seconds ... (1)
18:13:41.573 detox[43053] WARN:  at e2e/init.js:46:15 
    🔴  Retry #1 failed...
18:13:41.573 detox[43053] WARN:  at e2e/init.js:49:13 
 ️   ->  Retrying in 10 seconds ... (2)
18:13:51.784 detox[43053] WARN:  at e2e/init.js:46:15 
    🔴  Retry #2 failed...
18:13:51.785 detox[43053] WARN:  at e2e/init.js:49:13 
 ️   ->  Retrying in 15 seconds ... (3)
18:14:07.173 detox[43053] WARN:  at e2e/init.js:46:15 
    🔴  Retry #3 failed...
18:14:07.174 detox[43053] WARN:  at e2e/init.js:49:13 
 ️   ->  Retrying in 20 seconds ... (4)
    1) errors if permission denied

mikehardy avatar Jun 05 '23 18:06 mikehardy

The android CI failure appears to be a real failure related to the PR

https://github.com/invertase/react-native-firebase/actions/runs/5180171278/jobs/9333995832?pr=7165#step:19:1331


18:13:36.358 detox[43053] WARN:  at e2e/init.js:41:15 
 ⚠️ A test failed:
18:13:36.358 detox[43053] WARN:  at e2e/init.js:42:15 
 ️   ->  errors if permission denied
18:13:36.358 detox[43053] WARN:  at e2e/init.js:49:13 
 ️   ->  Retrying in 5 seconds ... (1)
18:13:41.573 detox[43053] WARN:  at e2e/init.js:46:15 
    🔴  Retry #1 failed...
18:13:41.573 detox[43053] WARN:  at e2e/init.js:49:13 
 ️   ->  Retrying in 10 seconds ... (2)
18:13:51.784 detox[43053] WARN:  at e2e/init.js:46:15 
    🔴  Retry #2 failed...
18:13:51.785 detox[43053] WARN:  at e2e/init.js:49:13 
 ️   ->  Retrying in 15 seconds ... (3)
18:14:07.173 detox[43053] WARN:  at e2e/init.js:46:15 
    🔴  Retry #3 failed...
18:14:07.174 detox[43053] WARN:  at e2e/init.js:49:13 
 ️   ->  Retrying in 20 seconds ... (4)
    1) errors if permission denied

I had no issues when running the tests locally 🤔 I can check it tomorrow @mikehardy

nahuelb avatar Jun 05 '23 18:06 nahuelb

@mikehardy I did some digging today, and I am a bit stuck. 😞

It seems I only ran the e2e tests on iOS when I submitted the PR, my bad. I am having some trouble making the e2e android environment work, I will try again when I have some free time.

But I was able to get the same error in my project, when doing a bad .get request I always got unknown error code. I updated this part of the code to be able to return the proper error code with something like this:

Exception e = task.getException();
DatabaseError error = DatabaseError.fromException(e);

rejectPromiseDatabaseException(
  promise,
  new UniversalDatabaseException(
    error.getCode(), error.getMessage(), error.toException()));

But this way I always get the error code -11 UserCodeException instead of -3 PermissionDenied. Do you know another way to get the proper firebase error code from the task exception? I don't have much experience working with Android code 🙏

nahuelb avatar Jun 06 '23 21:06 nahuelb

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Jul 04 '23 22:07 github-actions[bot]

Still hoping to help shepherd this one to merge but the summer has been busy

mikehardy avatar Aug 18 '23 00:08 mikehardy

Codecov Report

Merging #7165 (f9be916) into main (95d014c) will increase coverage by 13.37%. Report is 194 commits behind head on main. The diff coverage is 57.15%.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #7165       +/-   ##
=============================================
+ Coverage     53.93%   67.29%   +13.37%     
=============================================
  Files           230      129      -101     
  Lines         11509     5692     -5817     
  Branches       1851     1343      -508     
=============================================
- Hits           6206     3830     -2376     
+ Misses         4959     1751     -3208     
+ Partials        344      111      -233     

codecov[bot] avatar Aug 18 '23 00:08 codecov[bot]

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Sep 15 '23 00:09 github-actions[bot]

Note that from a modular / firebase-js-sdk v9 API perspective I think this may be superceded by the v9 conversion PR as get() is defined there: https://github.com/invertase/react-native-firebase/pull/7136/files?diff=unified&w=1#diff-f1acd77729eabe49ebe14ed78e0fe2a58fdf4f2b3e0266e52fea0b7d81e95a4cR46

mikehardy avatar Sep 19 '23 16:09 mikehardy

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Oct 17 '23 17:10 github-actions[bot]

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Dec 27 '23 00:12 github-actions[bot]

Just needs the investigation then the likely close as I do believe it was superceded

mikehardy avatar Jan 06 '24 19:01 mikehardy

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Feb 03 '24 20:02 github-actions[bot]

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Mar 18 '24 04:03 github-actions[bot]