Keystone-classic: Unhandled error 'Request Entity Too Large'

Created on 9 Aug 2014  路  6Comments  路  Source: keystonejs/keystone-classic

422 adds the ability to set a file size limit but the exception thrown is not handled properly.

Upload is stopped but the page rendered shows like this:
image
Server error: Error: Request Entity Too Large at Object.exports.error
It would be better if this is handled by req.flash error

enhancement

Most helpful comment

I appear to have fixed the issue I was having. I tried two solutions, and I'm not sure which one was the one that did it.

First, I use nginx to route https stuff on the server. I found this Stack Overflow thread that inspired me to add the following line to server block:

client_max_body_size 50M; #all file uploads up to 50 MB

I restarted nginx, but I was still getting the error. However, I didn't reboot the server or restart keystone.js.

The second thing I tried was to add this line to keystone.init() in keystone.js:

'file limit': '50MB'

I had no idea if this was the right syntax or not. But when I restarted keystone.js, it ran and didn't complain. I rebooted the server and when it came up I stopped getting the entity.to.large error.

Hopefully this helps someone in the future if they come across this issue.

All 6 comments

I agree, would welcome a PR fixing this. It should probably be implemented as a validation step on the field, and returned like the other validation errors.

Closing due to inactivity, feel free to comment again if this issue persists for you!

One of my clients just ran into this error when they tried to create a blog post using Keystone. I'm just starting down the path of researching it and figuring out a work around. I'd welcome any tips.

I appear to have fixed the issue I was having. I tried two solutions, and I'm not sure which one was the one that did it.

First, I use nginx to route https stuff on the server. I found this Stack Overflow thread that inspired me to add the following line to server block:

client_max_body_size 50M; #all file uploads up to 50 MB

I restarted nginx, but I was still getting the error. However, I didn't reboot the server or restart keystone.js.

The second thing I tried was to add this line to keystone.init() in keystone.js:

'file limit': '50MB'

I had no idea if this was the right syntax or not. But when I restarted keystone.js, it ran and didn't complain. I rebooted the server and when it came up I stopped getting the entity.to.large error.

Hopefully this helps someone in the future if they come across this issue.

@christroutner this just saved my ass. almost 2 years later. thanks mate

@christroutner this also just saved my life. almost 2 years later. thanks mate

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webteckie picture webteckie  路  5Comments

zhdan88vadim picture zhdan88vadim  路  5Comments

sorryididntmeantto picture sorryididntmeantto  路  3Comments

joernroeder picture joernroeder  路  5Comments

molomby picture molomby  路  5Comments