Closed suntong closed 1 year ago
Reopening #562 as I'm having the exact same problem, yet all answers from it, as well as the answers from #344 #413& #602, are not working for me.
I've provided a minimal reproduction case at
https://github.com/suntong/express-simple-example/tree/testing/upload/big I.e., https://github.com/suntong/express-simple-example/blob/testing/upload/big/index.js
The code finishes fine, but I'm wondering why I'm getting the following as well as returned json:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>openresty</center>
</body>
</html>
And how can I get rid of such error.
I've also tried to add the following suggested "solution",
// fixing "413 Request Entity Too Large" errors
app.use(express.json({limit: "10mb", extended: true}))
app.use(express.urlencoded({limit: "10mb", extended: true, parameterLimit: 50000}))
But removed them as they are not working either.
hi, can you specify which server are you using?
I'm running it on a powerful MS Azure server, a private one, not any public servers
I tried to give you the result of cpupower info
, but got:
Intel's performance bias setting needs root privileges
Ah, got it:
System memory size: 7GiB Cpu: Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
I've provided a fully functional minimal reproduction case, anyone can give it a try to verify, if you want.
@suntong if you look at the html error page you will se an indication where the error originates from:
<hr><center>openresty</center>
It seems like you are running OpenResty in front of Node.js, and it's OpenResty that is limiting your post body.
Closing since the problem is outside of Multer
I searched the whole project folder for KW: "openresty" but found nothing. I've provided a fully functional minimal reproduction case, can anyone try it please?
@suntong I can upload a 13 MB file with your minimal reproduction case.
$ git clone git@github.com:suntong/express-simple-example.git
$ cd express-simple-example
$ git checkout testing/upload/big
$ npm install
$ npm start
(then in another terminal)
$ curl -X POST http://localhost:3399/upload -F file=@my-large-file.zip
Oh, thanks a lot for trying @LinusU,
would you verify your index.js is the same as that of https://github.com/suntong/express-simple-example/blob/testing/upload/big/index.js please?
As the index.js is in the testing/upload/big
branch. Just want to double check as I don't see branch switching in your above commands. thx.
@suntong it's the same. I did forgot to put it in the above commands, but I did run it 👌
Will update the comment...
app.post('/messages/upload', upload.single('image'), async (req, res) => { // never get here as multer rejects as 413 (too large) }