Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayloadTooLargeError: request entity too large #135

Open
Monokai opened this issue May 21, 2023 · 3 comments
Open

PayloadTooLargeError: request entity too large #135

Monokai opened this issue May 21, 2023 · 3 comments

Comments

@Monokai
Copy link

Monokai commented May 21, 2023

I'm trying to plot an .SVG file of 9MB with lots of tiny paths. Saxi runs on a Raspberry PI with 4GB memory. The path planning phase goes ok, but nothing happens.

I'm running the latest Saxi on Node 18.16 on the PI. Looking in /var/log/syslog I see this:

PayloadTooLargeError: request entity too large
at readStream (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/raw-body/index.js:156:17)
at getRawBody (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/raw-body/index.js:109:12)
at read (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/body-parser/lib/read.js:79:3)
at jsonParser (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/body-parser/lib/types/json.js:135:5)
at Layer.handle [as handle_request] (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/express/lib/router/index.js:328:13)
at /home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/express/lib/router/index.js:286:9
at Function.process_params (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/express/lib/router/index.js:346:12)
at next (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/express/lib/router/index.js:280:10)
at serveStatic (/home/pi/.nvm/versions/node/v18.16.0/lib/node_modules/saxi/node_modules/serve-static/index.js:75:16)

Any ideas?

@wwatkns
Copy link

wwatkns commented Jul 18, 2024

Hey Monokai!

I had the same issue, I read through this thread on Stack Overflow https://stackoverflow.com/questions/19917401/error-request-entity-too-large then changed the line 19 in /src/server.ts from

app.use(express.json({limit: maxPayloadSize}));

to

let bodyParser = require('body-parser');
app.use(bodyParser.json({ limit: maxPayloadSize }));
app.use(bodyParser.urlencoded({ limit: maxPayloadSize,  extended: true, parameterLimit: 1000000 }));

I don't know the exact reason but it works for me now.
It seems to be an issue connected to the number of small lines rather than the file size.

@Monokai
Copy link
Author

Monokai commented Jul 18, 2024

Hah! Nice yo see you here @wwatkns, and thanks :) Now if I only remember what I was plotting a year ago. I might even have solved it by truncating all floating points, but your solution looks more future proof.

@wwatkns
Copy link

wwatkns commented Jul 20, 2024

Never mind, the issue popped up again for a different plot after I slowed down the down acc from 200 to 150mm/s²

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants