Back
Getting network request failed when trying to upload image to bucket in react native
- 0
- React Native
- Storage
- Cloud
៚მղოօl៚
so, this is the exact error i'm getting
TypeScript
(NOBRIDGE) ERROR Error uploading file: [AppwriteException: Network request failed]```
and this is my code
``` const AvatarHandle = async() => {
let avatar = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ['images'],
allowsEditing: true,
aspect: [4,3],
quality: 1,
})
if(!avatar.canceled) {
setImage(avatar.assets[0].uri);
const sessione = await account.get();
try {
const response = await fetch(avatar.assets[0].uri);
const blob = await response.blob();
const file = new File([blob], "image.jpg", { type: "image/jpeg" });
console.log("Uploading file to storage...");
const uploadedFile = await storage.createFile('BucketID', 'unique()', file);
console.log("File uploaded successfully:", uploadedFile);
} catch (error) {
console.error("Error uploading file:", error);
Toast.show({
type: 'error',
text1: 'Upload Failed',
text2: 'Network request failed. Please try again.'
});
}
}
}```
TL;DR
Developers are experiencing a network request failed error when trying to upload an image to a bucket in React Native using Appwrite. The code appears to be set up correctly, but the issue persists. A possible solution could be to double-check the BucketID and ensure that all permissions are correctly set up in the Appwrite console. ៚მղოօl៚
Though, everything else is just working fine, database & auth are just running smoothly. I tried a lot but seems issue is with appwrite, I just can't figure it out
Recommended threads
- [Messaging] Subscribe to topic directly ...
I want to subsribe a user to a topic directly after the user has created a push target. However when trying to do this, appwrite gives the error that the target...
- storage limit
hello I have question on the plan the bucket or storage is have max limit of 5GB what if it exceed to 5GB or more?
- How to do the equivalent of a JOIN query...
Hello, I'm trying to get documents from a collection but I need to make sure that the document I pull is unique to another document in another collection. If i...