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

fix: implement uploadBytes for storage modular sdk

Open johnsimeroth opened this issue 5 months ago • 9 comments

Description

This PR implements the uploadBytes storage function for the modular SDK, one of several unimplemented methods mentioned in https://github.com/invertase/react-native-firebase/issues/7483.

Related issues

https://github.com/invertase/react-native-firebase/issues/7483

Release Summary

Adds missing storage.uploadBytes implementation

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
    • [x] 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. (N/A)
  • This is a breaking change;
    • [ ] Yes
    • [x] No

Test Plan

No new tests, but all existing storage tests still pass. I would have mirrored any tests for uploadBytesResumable, but I didn't see any for that either.

image

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

🔥 My first PR here, LMK what you'd like to see different and I'm happy to make changes.

johnsimeroth avatar Sep 13 '25 18:09 johnsimeroth

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

Project Deployment Preview Comments Updated (UTC)
react-native-firebase Ready Ready Preview Comment Sep 13, 2025 6:13pm

vercel[bot] avatar Sep 13 '25 18:09 vercel[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 13 '25 18:09 CLAassistant

Can you write a test for this please?

MichaelVerdon avatar Sep 16 '25 10:09 MichaelVerdon

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 14 '25 10: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 Nov 26 '25 11:11 github-actions[bot]

It is nearly impossible to write automated tests for these storage upload/download methods because they run against an in-memory emulator on same host as the client, so there is insufficient delay (even with very large files) for a test to work.

I believe the only valid tests would work against cloud storage vs the emulator - which is possible now.

This is the entry point for our local tests:

https://github.com/invertase/react-native-firebase/blob/main/tests/local-tests/index.js

And if you run yarn tests:android:manual or yarn tests:ios:manual then use the little top menu of manual tests in the app once it starts, you can exercise something difficult to automate. If you do not put an emulator call in there it will go against the cloud storage, so in that way you could easily do a little test React Component that uploaded a file (then downloaded it and compared it I suppose) to make sure it was working.

mikehardy avatar Nov 29 '25 02:11 mikehardy

None of the CI errors are related to this PR - if you rebase to current main in this repo there are a bunch of CI fixes that should see things go green

mikehardy avatar Nov 29 '25 02:11 mikehardy

@johnsimeroth is attempting to deploy a commit to the Invertase Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Dec 04 '25 20:12 vercel[bot]

@mikehardy

The code seems reasonable - I assume this is working for you @johnsimeroth ?

Apologies for the delay! Looks like I need to sort out my github notification settings, I wasn't getting any of the responses here and I honestly forgot about this PR.

Yes, the code is the same that I added to my app, and it's been working as expected without issue.

It is nearly impossible to write automated tests for these storage upload/download methods because they run against an in-memory emulator on same host as the client, so there is insufficient delay (even with very large files) for a test to work.

I believe the only valid tests would work against cloud storage vs the emulator - which is possible now.

This is the entry point for our local tests:

https://github.com/invertase/react-native-firebase/blob/main/tests/local-tests/index.js

And if you run yarn tests:android:manual or yarn tests:ios:manual then use the little top menu of manual tests in the app once it starts, you can exercise something difficult to automate. If you do not put an emulator call in there it will go against the cloud storage, so in that way you could easily do a little test React Component that uploaded a file (then downloaded it and compared it I suppose) to make sure it was working.

That seems sensible - If you'd like to see that setup as part of this PR I can find some time next week to take a crack at it.

None of the CI errors are related to this PR - if you rebase to current main in this repo there are a bunch of CI fixes that should see things go green

In the interim, I've rebased as requested.

johnsimeroth avatar Dec 04 '25 20:12 johnsimeroth