Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: Error in Storage API createFile function #963

Open
2 tasks done
abhishek-visitnow opened this issue Aug 27, 2024 · 7 comments · Fixed by #991 or #992
Open
2 tasks done

🐛 Bug Report: Error in Storage API createFile function #963

abhishek-visitnow opened this issue Aug 27, 2024 · 7 comments · Fixed by #991 or #992
Labels
bug Something isn't working

Comments

@abhishek-visitnow
Copy link

👟 Reproduction steps

I'm trying to upload a file greater than 4 Mb. Following code is working when the size of file is less than 4 mb.

Using dotnet sdk v0.8.3

File myfile = await storage.CreateFile(
                 bucketId: "bucket-id",
                 fileId: ID.Unique(),
                 file: InputFile.FromBytes(
                     Encoding.UTF8.GetBytes(json),
                     "filename.json,
                     "application/json"
                     ),
                 permissions: permissions! // optional
             );

👍 Expected behavior

It should upload the file.

👎 Actual Behavior

Getting following error:

Appwrite.AppwriteException: The requested route was not found. Please refer to the API docs and try again.
   at Appwrite.Client.Call[T](String method, String path, Dictionary`2 headers, Dictionary`2 parameters, Func`2 convert)
   at Appwrite.Client.ChunkedUpload[T](String path, Dictionary`2 headers, Dictionary`2 parameters, Func`2 converter, String paramName, String idParamName, Action`1 onProgress)
   at DotNetRuntime.Handler.Main(RuntimeContext Context) in /usr/local/server/src/Index.cs:line 67
   at DotNetRuntime.Program.Action(HttpRequest request) in /usr/local/server/src/Program.cs:line 194

🎲 Appwrite version

Version 1.5.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@abhishek-visitnow abhishek-visitnow added the bug Something isn't working label Aug 27, 2024
@stnguyen90 stnguyen90 transferred this issue from appwrite/appwrite Aug 27, 2024
@stnguyen90
Copy link
Contributor

@adityaoberai looked into this and noticed we're still checking for "unique()"

https://github.com/appwrite/sdk-for-dotnet/blob/e0ca49126bb8cf97b0826c8acd7af12b244ea920/Appwrite/Client.cs#L408

even though ID.unique() doesn't return "unique()" anymore:

https://github.com/appwrite/sdk-for-dotnet/blob/e0ca49126bb8cf97b0826c8acd7af12b244ea920/Appwrite/ID.cs#L22-L35

Looks like we're going to need to fix this in the following SDKs:

@stnguyen90 stnguyen90 transferred this issue from appwrite/sdk-for-dotnet Aug 27, 2024
@stnguyen90 stnguyen90 changed the title 🐛 Bug Report: Error in Storage API createFile function of dotnet SDK 🐛 Bug Report: Error in Storage API createFile function Aug 27, 2024
@abhishek-visitnow
Copy link
Author

@stnguyen90 Does this mean it will work if I add a string Id to fileId?

@abhishek-visitnow
Copy link
Author

abhishek-visitnow commented Aug 28, 2024

I see the variable name is mismatched path: "$path/${params[idParamName]}",. Right one: path: "$path/${parameters[idParamName]}",

@abhishek-visitnow
Copy link
Author

@stnguyen90 Any update on this?

@dev-p26
Copy link

dev-p26 commented Sep 25, 2024

Any plan for when this fix is going to be released?

@abhishek-visitnow
Copy link
Author

New version of DotNet SDK is released
https://github.com/appwrite/sdk-for-dotnet/releases/tag/0.10.1

With a release note: fix: chunk upload by @byawitz in #52

I installed this version and ran a test. Now new error appears:

Unhandled exception. System.AggregateException: One or more errors occurred. (<Error><Code>EntityTooSmall</Code><Message>Your proposed upload is smaller than the minimum allowed size</Message><ProposedSize>5242879</ProposedSize><MinSizeAllowed>5242880</MinSizeAllowed><PartNumber>1</PartNumber><ETag>957c613714e7d16b7ded33a219d44296</ETag><RequestId>MYQY22S4WCGBKZNG</RequestId><HostId>aV7Q2T/3R8O7A9hkOJiLeMA+bc1y6gTBvIGv3OLJO09wdBy18uRnr6D7xvcuTcQJcrVJltzywh8=</HostId></Error>)
 ---> Appwrite.AppwriteException: <Error><Code>EntityTooSmall</Code><Message>Your proposed upload is smaller than the minimum allowed size</Message><ProposedSize>5242879</ProposedSize><MinSizeAllowed>5242880</MinSizeAllowed><PartNumber>1</PartNumber><ETag>957c613714e7d16b7ded33a219d44296</ETag><RequestId>MYQY22S4WCGBKZNG</RequestId><HostId>aV7Q2T/3R8O7A9hkOJiLeMA+bc1y6gTBvIGv3OLJO09wdBy18uRnr6D7xvcuTcQJcrVJltzywh8=</HostId></Error>
   at Appwrite.Client.Call[T](String method, String path, Dictionary`2 headers, Dictionary`2 parameters, Func`2 convert)
   at Appwrite.Client.ChunkedUpload[T](String path, Dictionary`2 headers, Dictionary`2 parameters, Func`2 converter, String paramName, String idParamName, Action`1 onProgress)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at DotNetRuntime.Program.Main(String[] args) in /src/Index.cs:line 43

@jamminuesa
Copy link

Hello, any update on this? I am using the android sdk and I have a similar problem with large files that cannot not be uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants