Back

Getting null when using GetFileDownload

  • 0
  • Self Hosted
  • Functions
  • Storage
THE-E
28 Jan, 2024, 17:07

Hi there,

I am currently using the SDK of .NET and I am facing an issue when using the GetFileDownload-function. Whenever I use the function I get a null-value as return.

TypeScript
Appwrite.Models.File fileTest = await storage.GetFile(bucketId: bucketId,fileId: image.OriginalFileId);
byte[] originalImage = await storage.GetFileDownload(bucketId: bucketId,fileId: image.OriginalFileId);

To narrow it down, I used the GetFile-function as well (as you can see above) and I am getting a correct response, with all the file details such as filename etc. The file has authorized the user to read, update and delete (authentication using JWT).

In the appwrite logs I am getting the error:

TypeScript
[Error] Message: Storage bucket with the requested ID could not be found.
[Error] File: /usr/src/code/app/controllers/api/storage.php
[Error] Line: 1014

In the GetFileDownload-function itself in the SDK I don't see the URL-parameter projectId passing.

A general question: Does anyone know, how I can debug the .NET SDK?

BTW: I already tried to contribute by creating an PR for an other issue, but there is little movement in that repository.

TL;DR
Hi, I am facing an issue with the `GetFileDownload` function in the .NET SDK. It always returns null. I have checked with the `GetFile` function and it works fine. The error message in the logs says that the storage bucket ID could not be found. It seems that the `GetFileDownload` function does not pass the URL parameter for the project ID. Does anyone know how to debug the .NET SDK? Solution: To fix the issue with `GetFileDownload`, make sure that the storage bucket ID is correct and that the project ID is passed as a URL parameter. To debug the .
Drake
28 Jan, 2024, 17:20

For your PR, I suggest posting in #đŸ‘·â”‚maintainers about it to remind us about it. Im not so good at looking at PRs

Drake
28 Jan, 2024, 17:21

@Aditya Oberai have you noticed any problems with downloading file using the dotnet SDK?

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