Occasionally (twice in the last two days) I get an error document_already_exists when uploading an image to storage. I am using ID.unique. The code to upload the image:
TypeScript
final storage = Storage(client);
final file = await storage.createFile(
bucketId: storageId,
fileId: ID.unique(),
file: InputFile.fromPath(
path: event.imagePath!,
filename: event.imagePath!.split("/").last));
This doesn't happen every time, but it has happened twice in the last two days. What could be causing this and how to fix it?
TL;DR
Issue: Error "document_already_exists" occurs sporadically when uploading images to storage using ID.unique.
Solution: The error is likely due to a coincidence where the generated unique ID matches an existing document ID in the storage. To resolve this, consider implementing a check for the existence of a document with the generated ID before uploading to ensure uniqueness.Recommended threads
- After assigning a domain to my Dart func...
I’ve attached the images. Could anyone please explain how this execution is being performed?
- Provider not enabled in Dotnet project
# Bug Report: Appwrite .NET SDK `CreateOAuth2Token` → `project_provider_disabled` ## Issue Using **Appwrite .NET SDK (v3.1.0)**, `CreateOAuth2Token` for Googl...
- Stuck on project restoration after inact...
Hey there! My project was paused due to inactivity today. I tried to restore it, but it's completely stuck on the restoration process. Could someone please tak...