async uploadProfilePicture(fileUri: string, phoneNumber: string) {
try {
// Get the file extension and use it to create the file name
const fileType = fileUri.split('.').pop();
const fileName = ${phoneNumber}.${fileType};
TypeScript
// Fetch the file data from the URI
const response = await fetch(fileUri);
if (!response.ok) {
throw new Error('Failed to fetch the image file.');
}
const fileBlob = await response.blob();
// Create a new File object without explicitly setting the MIME type
const file = await storage.createFile(
'66d17e5b0023edd74cde', // Replace with your bucket ID
ID.unique(),
new File([fileBlob], fileName)
);
return file; // Returns the file metadata
} catch (error: any) {
console.error('Error uploading profile picture:', error);
if (error.message.includes('Network request failed')) {
Alert.alert('Network Error', 'Please check your internet connection and try again.');
} else {
Alert.alert('Upload Error', 'There was an error uploading your profile picture. Please try again.');
}
throw error; // Rethrow the error after handling it
}
} This is showing following error [Appwrite exception:Network Request Failed] Please help
TL;DR
The developers are experiencing a "Network Request Failed" exception in their Appwrite app. The issue is occurring during the uploadProfilePicture function. The error is being caught and handled with an alert message based on the error type. The solution suggests checking the internet connection and trying again if a network error is detected.[Appwrite exception:Network Request Failed]
Recommended threads
- Issue related to index
Why it is showing this error?
- Appwrite Functions not executing with a ...
I have multiple functions running with a CRON Job however, they all stopped executing around 35 mins ago from this post. Project ID:6a4a03920012bede992d Region:...
- Function deployments broken for 5+ hours
```Function builds in project 6a46b5... (NYC) have failed 100% since ~2026-07-08 21:53 UTC (4+ hours) with [sidecar:build] Build archive was not created at /mnt...