Closed
Description
- Version:
v16.0.0-v8-canary202104037284782541
- Platform: Windows 10 20H1, x64
- Subsystem: environment
What steps will reproduce the bug?
For file uploading to the cloud, I'm using Multer ("multer": "^2.0.0-rc.2"
). With Node.js 15.3.0 everything is working great, after upgrading to 16.0.0 (starting end of March 2021) I'm getting the following error:
node:internal/process/promises:245
triggerUncaughtException(err, true /* fromPromise */);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received null
at TempWriteStream.WriteStream (node:internal/fs/streams:360:5)
at new TempWriteStream (C:\Users\User\IdeaProjects\TMS\node_modules\fs-temp\lib\write-stream.js:6:15)
at Object.createWriteStream (C:\Users\User\IdeaProjects\TMS\node_modules\fs-temp\lib\temp.js:121:10)
at Busboy.<anonymous> (C:\Users\User\IdeaProjects\TMS\node_modules\multer\lib\read-body.js:70:27)
at Busboy.emit (node:events:369:20)
at Busboy.emit (C:\Users\User\IdeaProjects\TMS\node_modules\busboy\lib\main.js:37:33)
at PartStream.<anonymous> (C:\Users\User\IdeaProjects\TMS\node_modules\busboy\lib\types\multipart.js:214:13)
at PartStream.emit (node:events:369:20)
at HeaderParser.<anonymous> (C:\Users\User\IdeaProjects\TMS\node_modules\dicer\lib\Dicer.js:50:16)
at HeaderParser.emit (node:events:369:20) {
code: 'ERR_INVALID_ARG_TYPE'
}
Process finished with exit code 1
When I'm rolling back to 15.3.0 no error occurs.
After some investigation, I've found out that the source of the issue is await asyncUpload(req, res);
.
The code snippet:
const _upload = multer({
limits: {
fileSize: CONFIG_STORAGE.uploader.maxFileSizeInBytes
}
}).single("file");
const asyncUpload = promisify(_upload);
await asyncUpload(req, res);
What's for sure, this issue happens on Node.js 16.0.0+ starting end of March, on Feb. nightly builds everything used to be OK.