Issue: Creating a file with the fileId set to "unique()" breaks storage in Appwrite. File cannot be accessed, updated, or deleted.
Potential solution: The use of "unique()" as the fileId is causing this issue. Instead, generate a unique random id for the fileId parameter when creating a file. Creating an issue on the Appwrite GitHub repository could help in preventing the usage of "unique()" as the fileId in the future.
SDK Used: Go SDK
Further information: The code does not match the behavior of other SDKs. It seems that passing "unique()" as the value of the x-appwrite-id header causes problems
Nevus
Rank 4: Virtual Machine
May 16, 2023, 14:34
Binyamin
May 16, 2023, 14:39
What are you doing before you get this error?
Can you share screenshot of that?
Nevus
Rank 4: Virtual Machine
May 16, 2023, 14:41
uploading file to the createFile endpoint using unofficial go sdk
Nevus
Rank 4: Virtual Machine
May 16, 2023, 14:42
I set the fileId to unique() but its being set to literal unique() instead of a random uid.
Okay?
So you have file with string id equals to unique()?
Nevus
Rank 4: Virtual Machine
May 16, 2023, 14:53
Yes.
Nevus
Rank 4: Virtual Machine
May 16, 2023, 14:54
It should have generated a unique random id but it didn't. Since, every other SDK uses the same process I am missing something. Just dont know what.
Binyamin
May 16, 2023, 14:57
Okay, But this error is in the console, right?
Is it show when you load the list?
Nevus
Rank 4: Virtual Machine
May 16, 2023, 15:00
ahh I think we are going in circles. Here's what happened.
I created a file using CreateFile endpoint. The endpoint has a fileId parameter. The value for that was set to unique()
The file upload succeded. The return value of json has id: unique()
The file appears in console. However, it cannot be accessed, updated or deleted. This happens for all platforms: console, SDK and REST. I dont know GraphQL but there's no reason to suspect otherwise.
Nevus
Rank 4: Virtual Machine
May 16, 2023, 15:01
Yes, I can see the file but that's it. There's no way to interact with the file whatsoever except deleting the bucket itself.
Binyamin
May 16, 2023, 15:10
Got you, okay.
Because you're using the cloud you can't access the DB directly and change the file ID manually. so you'll need to wait to an answer for that from a core user.
The code doesn't quite match up with how our other SDKs work. It looks like unique() is being passed in the x-appwrite-id header which breaks things...Appwrite should probably block that from happening, so it would be good if you created an issue so we make sure this doesn't happen