-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Cannot upload images via method UploadClient.uploadFile on android using Expo Go.
I get the following error:
"Cannot create URL for blob!"
When I try to upload an image to Uploadcare via the JS api client, it fails on android only
Expected behavior
The image 'test.jpg' is expected to be uploaded to ImageCare upon following code being executed:
Code / screenshots
import { UploadClient } from '@uploadcare/upload-client'
const client = new UploadClient({ publicKey: 'XXXXXXXXX', })
// Uploads an image to UploadCare
export const uploadToUploadCare = async (blob: Blob, fileName: string) => {
try {
const fileRef = await client.uploadFile(blob, {
fileName,
})
return fileRef.cdnUrl
} catch (e) {
console.warn(e)
throw e
}
}
// Grabs first image from gallery and calls uploadToUploadCare
const testUploader = async () => {
try {
const images = await MediaLibrary.getAssetsAsync({
sortBy: 'creationTime',
first: 1,
mediaType: [MediaType.photo, ],
})
const img = await fetch(images.assets[0].uri)
const blob = await img.blob()
await uploadToUploadCare(blob, 'test.jpg')
} catch (e) {
alert(e)
}
}
testUploader()
Environment
-
Library version:
5.1.1 -
Language/framework version:
expo: 46.0.0(managed workflow)
react-native: 0.69.6 -
OS version:
Android 11 (OnePlus 6)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working