Strapi CMS will only upload large files on localhost but won't upload them in production on Railway-hosted backend

swdcappHOBBY

5 months ago

I'm experiencing an issue where Strapi successfully uploads large files (e.g., videos) when running on localhost, but fails to do so in a production environment hosted on Railway. This issue seems to persist even with adequate resource allocation on Railway.

Environment Details

  • Strapi Version: 4.22.1

  • Node.js Version: 20.11.1

  • Database: PostgreSQL

  • Host: Railway

  • Resources: 8 GB RAM / 8 vCPU per service

Steps to Reproduce

  1. Run Strapi locally with the same configuration as in production.

  2. Attempt to upload a large file (e.g., 500 MB or more).

  3. Observe that the file uploads successfully in localhost.

  4. Deploy the same Strapi app to Railway.

  5. Attempt the same large file upload in production.

  6. Notice that the upload fails.

Expected Behavior
Large files should upload successfully in production, just as they do on localhost.

Actual Behavior
Large files fail to upload in production hosted on Railway, with no clear error in logs or indications of resource limits being exceeded.

Additional Context

  • I have configured the upload plugin in Strapi to handle large files, and it works fine locally.

  • My Railway service allocation is substantial (8 GB RAM / 8 vCPU).

Is there something I'm missing in configuring Strapi for production, or could this be an issue with Railway's file handling capabilities?

Solved

5 Replies

5 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 5 months ago


swdcappHOBBY

5 months ago

are there any resource limits set by railway, stopping me from uploaading files of 1gb and above?


5 months ago

Hello, we do not have any such file size limits, the only limit we have would be a 5 minute timeout limit, if your files take longer than 5 minutes to upload that request will be canceled.


5 months ago

While I appreciate the extra info in this thread, in the future, please do not open duplicate threads.


swdcappHOBBY

5 months ago

But some times larger uploads will take longer than 5 minutes...what would be the best course of action for me..as my application relies heavily on these large video files


5 months ago

You would need to use chunked uploads.

Or if the Strapi app itself doesn't need to directly access the video files on disk, store video media in an S3 bucket and for uploads return a signed url so that the clients upload directly to S3 instead of to your Strapi app.

For S3 I recommend Cloudflare R2.


Status changed to Solved brody 5 months ago