-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
UnhandledPromiseRejectionWarning: Error: Unexpected end of form #10264
Comments
I can't replicate this with the code you've provided. I exported to zip, unzipped, installed, used |
Sorry i can't share my Private repo, i'm researching about this problem, and i found that is caused for a bad format of a request in boundaries, i'm trying this in postman and this is his HTTP Request `POST /inquiry HTTP/1.1 ----WebKitFormBoundary7MA4YWxkTrZu0gW 6b652e73-7f79-4fef-bfbf-b9808c08be3f ["87ae9485-c2d1-4dc2-bbdc-80599c77f88c"] ["c842fd3d-b0e5-4473-b6f5-b546957876b9"] ["329f84ff-7f27-49cb-a0e1-3ed5a93fa353"] {"c842fd3d-b0e5-4473-b6f5-b546957876b9":["9ffc6437-871c-4ec6-85ae-5698a295d40f"]} {"329f84ff-7f27-49cb-a0e1-3ed5a93fa353":["86aa6d24-558c-49d5-9659-d0cde3293f98.JPEG"]} {"87ae9485-c2d1-4dc2-bbdc-80599c77f88c":["07740df4-9d46-48a2-9d04-9fb229998e9d"]} (data) (data) |
apparently this is happening since the form is not closing |
That sounds like it would bean error with multer (or even busboy) and not directly related to Nest (unless multer has already patched this and we haven't updated the multer package). I'd suggest replicating this, without Nest, and reporting it to the appropriate package's repository |
@jmcdo29 FYI we're been facing a similar issue, and here's where I'm at. Some malformed requests can trigger those unhandled rejections (like it's filed here). It cannot be fixed by That said, others cases of malformed requests are not triggering those out-of-band rejections, but are returned by Nest as 500 errors where they should be 400. There are 2 levels to it:
Anyways, I've opened #10880 for the mild cases, and I'm still looking at the issue between multer and busboy |
FYI I tracked the first case where a malformed request can take down the nodejs/nestjs app, and opened an issue + PR with |
Any update on this? We are also facing the same issue where a malformed request crashes the service with the following error:
|
Is there an existing issue for this?
Current behavior
When I use the AnyfilesInterceptor() interceptor I get this error:
(node:3446) UnhandledPromiseRejectionWarning: Error: Unexpected end of form at Multipart._final (/Users/mateozapatamaldonado/Documents/Apps/Personal/Authentication-Container/Authentication-Backend/node_modules/busboy/lib/types/multipart.js:588:17) at callFinal (internal/streams/writable.js:610:10) at processTicksAndRejections (internal/process/task_queues.js:82:21) (Use
node --trace-warnings ...to show where the warning was created) (node:3446) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:3446) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Minimum reproduction code
https://codesandbox.io/s/brave-brattain-n670t2?file=/src/app.controller.ts
Steps to reproduce
No response
Expected behavior
I have searched for many sides but the error seems to be an internal error of the library, I would like it not to happen.
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
9.0.0
Packages versions
`
{
"name": "authentication-backend",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write "src//*.ts" "test//.ts"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint "{src,apps,libs,test}/**/.ts" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"test:e2e:watch": "jest --config ./test/jest-e2e.json --watch"
},
"dependencies": {
"@nestjs/axios": "^0.1.0",
"@nestjs/common": "^9.0.8",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.0.8",
"@nestjs/mongoose": "^9.2.0",
"@nestjs/platform-express": "^9.0.8",
"@nestjs/typeorm": "^9.0.0-next.2",
"amazon-cognito-identity-js": "^5.2.10",
"aws-cognito-jwt-verifier": "^1.3.7",
"aws-sdk": "^2.1189.0",
"b64-to-blob": "^1.2.19",
"base64-blob": "^1.4.1",
"class-transformer": "^0.5.1",
"class-transformer-validator": "^0.9.1",
"class-validator": "^0.13.2",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.5.1",
"mysql": "^2.18.1",
"nest-aws-sdk": "^3.0.0",
"nestjs-config-aws-ksm": "^1.0.5",
"nestjs-form-data": "^1.7.1",
"nestjs-i18n": "^9.1.5",
"node-fetch": "2.6.1",
"path": "^0.12.7",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.6",
"typeorm": "^0.3.7",
"typeorm-naming-strategies": "^4.1.0"
},
"devDependencies": {
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.1",
"@nestjs/testing": "^9.0.8",
"@types/jest": "^28.1.6",
"@types/multer": "^1.4.7",
"@types/node": "^18.6.4",
"@types/supertest": "^2.0.12",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"eslint": "^8.21.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "28.1.3",
"prettier": "^2.7.1",
"sqlite3": "^5.0.11",
"supertest": "^6.2.4",
"ts-jest": "^28.0.7",
"ts-loader": "^9.3.1",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.0",
"typescript": "^4.7.4"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".\.spec\.ts$",
"transform": {
"^.+\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
`
Node.js version
14
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: