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

Downloading files of about 5Mb results in an "internal server error" #3750

Open
IjzerenHein opened this issue Dec 7, 2023 · 3 comments
Open
Labels

Comments

@IjzerenHein
Copy link

IjzerenHein commented Dec 7, 2023

Version

5.38.1 (but also applies to 5.33.0)

Operating System

Mac OSX

Browser

Google Chrome

What are the steps to reproduce this bug?

Setup a fresh Webiny project:

  • npx create-webiny-project my-filemanager-test
  • yarn webiny deploy
  • Finish the setup and complete the installation wizard

Upload a file and try to download it

  • Go to the Admin app and upload the attached file to the File Manager
  • Attempt to download the file
  • This results in the lambda returning "internal server error", instead of downloading the file

File that causes the problem

hein_test.mp4

What is the expected behavior?

The file should be downloaded successfully

What do you see instead?

{"message":"Internal Server Error"}

Additional information

The interesting part is that larger files and smaller files do work. However, we have several files in this ~5 Mb file range and they all seem to fail. It looks like it has something to do with the fact that the filemanager lambda switches to a 301 for larger files and serves smaller files directly. But somewhere in the middle it fails.

Possible solution

No response

@IjzerenHein IjzerenHein added the bug label Dec 7, 2023
@IjzerenHein
Copy link
Author

IjzerenHein commented Jan 3, 2024

We did some further experimentation, and it seems that files smaller than 4703427 bytes and files larger than 5095107 always seem to work. But somewhere between that range the file-manager is unable to serve the files and returns internal server error.

Looking at the implementation, there seems to be a limit or 5000000 which serves as a switch from the serving the file directly or redirecting the file to be served from the bucket:
https://github.com/webiny/webiny-js/blob/next/packages/api-file-manager/src/handlers/download/getS3Object.ts#L17C27-L17C61

From what I can see, it appears that this limit of 5000000 is too large and should probably be decreased to something like 4700000.

@ptdatta
Copy link

ptdatta commented Feb 3, 2024

@IjzerenHein Can I give it a try/

@IjzerenHein
Copy link
Author

@ptdatta yes please, can you reproduce it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants