Back

[SOLVED] Getting a file in Storage via fetch?

  • 0
  • Web
  • Storage
saricden
6 Jun, 2023, 10:29

Hi everyone, I'm receiving the error in the screenshot whenever my code attempts to download files via a fetch call.

Weirdly, I'm able to create new Audio() objects using the URLs returned from the Storage SDK functions.

I have tried both storage.getFileDownload as well as storage.getFileView and my permissions for the bucket in question are set to allow all users to both create and read.

Does anyone know the step I'm missing?

TL;DR
The user was encountering an error when trying to download files via a fetch call. They were able to create `new Audio()` objects using the URLs returned from the Storage SDK functions. The issue was likely due to fetch not including the appwrite cookies in the request, causing the user to be unauthenticated. The problem was solved by changing the permissions to allow any user to read. The user's goal was to get the audio files in blob form.
saricden
6 Jun, 2023, 10:34

My goal is to get these audio files in blob form

saricden
6 Jun, 2023, 11:28

Aha, changing my permissions to allow Any to read solved the issue.

Guille
6 Jun, 2023, 14:41

If you don't have any other question, can you mark your issue as solved?

Drake
6 Jun, 2023, 15:51

btw, your problem was probably due to fetch not including the appwrite cookies in your request so you were unauthenticated

saricden
6 Jun, 2023, 23:32

@Guille yep I'll mark it resolved now

saricden
6 Jun, 2023, 23:32

Ahhh

saricden
6 Jun, 2023, 23:32

I see

saricden
6 Jun, 2023, 23:32

Thanks @Steven

saricden
6 Jun, 2023, 23:33

[Resolved] Getting a file in Storage via fetch?

Drake
6 Jun, 2023, 23:54

[SOLVED] Getting a file in Storage via fetch?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more