a year ago
I am have an issue with 413 PayloadTooLargeError when I try to upload 2.4 Mb image
Cloudinary limit is 10 Mb
Strapi limits that I set is 250 Mb
plugings.js
module.exports = ({ env }) => ({ upload: { config: { sizeLimit: 250 * 1024 * 1024,
middlewares.js
{ name: "strapi::body", config: { formLimit: "256mb", jsonLimit: "256mb", textLimit: "256mb", formidable: { maxFileSize: 250 * 1024 * 1024, }, }, },
I am wondering maybe I need also to configure nixpacks.toml or something like that to prevent this issue
11 Replies
a year ago
Railway does not have a max upload size limit, I have uploaded files many times that size without issue.
The only relevent limitation would be a 5 minute time limitation, but you would not get back 413.
There is something in your project that is limiting the upload size.
a year ago
The thing is that it works locally, no limitations
Ok, I will try to invistigate further
a year ago
Does node.js on railway use nginx?
https://docs.strapi.io/dev-docs/plugins/upload#max-file-size
You may also need to adjust any upstream proxies, load balancers, or firewalls to allow for larger file sizes.
(e.g. Nginx has a config setting called clientmaxbody_size that will need to be adjusted since it's default is only 1mb.)
a year ago
Wish I could tell you what it was, but I can promise you with up most certainty that there is not a platform limitation preventing you from uploading a 2.4mb file.
A standard node.js deployment does not use NGINX, and neither does Railway.
a year ago
If you wanted extra reassurance of this not being an issue with the platform, you can test for yourself -
a year ago
When I change local upload provider to Cloudinary, I receive 413 as well. Probably I should check why
I am able to upload via admin panel, but no via /api/upload POST
The issue is not connected to railway
a year ago
After investigation, the problem is on client side. I am cropping image and convert it to blob, and in result somehow its size converts from 2.4 Mb to 10.53 Mb and doesn't meet Cloudinary limit.
So the issue with converting to blob, which may be non-obvious in terms of file-size
Status changed to Solved railway[bot] • about 1 year ago
a year ago
More information for those who might have the same issue:
https://github.com/fengyuanchen/cropper/issues/542
.toBlob(…, 'image/jpeg', 90); will help