ppresume / community

Discussions, feedbacks, roadmaps, community.
57 stars 3 forks source link

feat: increase the body size limit for resume update #32

Closed xiaohanyu closed 3 months ago

xiaohanyu commented 3 months ago

Description

Found some error logs in ppresume server:

ppresume-api-1  | [09:07:27] ERROR (payload): PayloadTooLargeError: request entity too large
ppresume-api-1  |     at readStream (/app/node_modules/.pnpm/raw-body@2.5.1/node_modules/raw-body/index.js:156:17)
ppresume-api-1  |     at getRawBody (/app/node_modules/.pnpm/raw-body@2.5.1/node_modules/raw-body/index.js:109:12)
ppresume-api-1  |     at read (/app/node_modules/.pnpm/body-parser@1.20.1/node_modules/body-parser/lib/read.js:79:3)
ppresume-api-1  |     at jsonParser (/app/node_modules/.pnpm/body-parser@1.20.1/node_modules/body-parser/lib/types/json.js:135:5)
ppresume-api-1  |     at Layer.handle [as handle_request] (/app/node_modules/.pnpm/express@4.18.2/node_modules/express/lib/router/layer.js:95:5)
ppresume-api-1  |     at trim_prefix (/app/node_modules/.pnpm/express@4.18.2/node_modules/express/lib/router/index.js:328:13)
ppresume-api-1  |     at /app/node_modules/.pnpm/express@4.18.2/node_modules/express/lib/router/index.js:286:9
ppresume-api-1  |     at Function.process_params (/app/node_modules/.pnpm/express@4.18.2/node_modules/express/lib/router/index.js:346:12)
ppresume-api-1  |     at next (/app/node_modules/.pnpm/express@4.18.2/node_modules/express/lib/router/index.js:280:10)
ppresume-api-1  |     at middleware (/app/node_modules/.pnpm/payload@2.5.0_esbuild@0.18.20_typescript@4.9.5_webpack@5.89.0/node_modules/payload/dist/localization/middleware.js:46:16)

By default, express apply a 100kb limit for body parser: https://expressjs.com/en/resources/middleware/body-parser.html.

We can relax this limit for some MB. I will take 10 MB as the limit here, which is 100x larger than the default—can't believe anybody's resume would have more than 10MB in plain text.

[Optional] Possible Solutions

NA

Acceptance Criteria

Todo list

NA

xiaohanyu commented 3 months ago

Fixed.

We increased the payload limit from 100kb to 10mb, which is 100x, I don't beleive any body would have a resume that is more than 10mb, LOL.