Last active
March 23, 2026 12:24
-
-
Save goshmx/93925c75285c6726aa88 to your computer and use it in GitHub Desktop.
Fix Sails js error . Request entity too large. Code 413
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //This fragment goes in your config/http.js file. | |
| //Ensure to install skipper previusly... | |
| //Tested in Sails.js v0.10.5 | |
| module.exports.http = { | |
| bodyParser: (function () { | |
| var opts = {limit:'50mb'}; | |
| var fn; | |
| // Default to built-in bodyParser: | |
| fn = require('skipper'); | |
| return fn(opts); | |
| }) | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are seeing a http error 413 Payload Too Large error while working with Sails.js, it is almost always due to the default body parser settings. Sails uses
skipperas its default body parser, which has a default limit of ~10MB.To fix this, you need to adjust the
httpconfiguration.1. Update
config/http.jsIn your Sails project, locate
config/http.js. You need to explicitly set themaxBytesfor the body parser inside themiddlewareobject.2. Handling File Uploads in Controllers
If the error occurs specifically during a file upload using
req.file(), you should also pass themaxBytesoption directly in your controller action:Important Considerations: