Image upload errors after upgrade 30.0.0 -> 31.0.0

Hi, I have an ejected Expo app and am using ImagePicker → ImageManipulator to get a file://…uri
I’m them using a firebase documentation trick to upload the raw data to an S3 bucket:

return fetch(uri)
		.then(file => file.blob())
		.then(blob => {
			return fetch(signedUploadUrl, {
				method: 'PUT',
				body: blob,
				headers: {
					'Content-Type': 'application/jpeg'
				}
			});
		});

See Snack: https://snack.expo.io/@mark-pod/upload-issue

Since 31.0.0 this has stopped working on both iOS and Android, see errors:

Android
[15:50:42] Network request failed

  • node_modules/react-native/Libraries/vendor/core/whatwg-fetch.js:504:29 in onerror
  • node_modules/event-target-shim/lib/event-target.js:172:43 in dispatchEvent
  • … 8 more stack frames from framework internals

Hey @mark-pod,

I believe this is related to this issue. There is a problem with RN’s blob implementation currently, but there is a PR waiting to be merged. You can find the fix in the issue I linked. You just have to add a snippet to whatwg-fetch.js.

Let me know if that fixes it for you.

Cheers,

Adam

Once you publish though, it will reinstall the module and will cause error in live. I guess you can just npm i fetch and use that instead ?

Hi Adam,
You were correct, that issues was the problem. The workaround that uses the XRH request to load the blob solves my problem for now.
Manky thanks!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.