Sorting
-
I'm submitting a ...
-
I confirm that I
Expected Behavior
If an error occurs during reading a file returned as Promise<Readable>, (such as, if the file doesn't exist), tsoa should respond with 500 Internal Server Error.
Current Behavior
Node shuts down with:
[Error: ENOENT: no such file or directory, open '/non-existent-file'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/non-existent-file'
}
ELIFECYCLE Command failed with exit code 1.
Context (Environment)
Version of the library: 4.1.3
Version of NodeJS: 18.16.0
I actually use pnpm, but I doubt it has anything to do with this.
Steps to reproduce
@Get('somefile')
@SuccessResponse(200, "JS module file", "text/plain")
async getSomeFile(
@Request() req: ExpressRequest
): Promise<Readable> {
req.res?.setHeader('content-type', 'text/plain');
return fs.createReadStream('/non-existent-file');
}
Just call this controller to reproduce the bug.
Detailed Description
Seems that tsoa doesn't add on('error') handler to the stream. I can add my own, but I found no way to respond with error code. If I just log the error in the error handler, the request hangs indefinitely.
Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
If an error occurs during reading a file returned as Promise<Readable>, (such as, if the file doesn't exist), tsoa should respond with 500 Internal Server Error.
Current Behavior
Node shuts down with:
Context (Environment)
Version of the library: 4.1.3
Version of NodeJS: 18.16.0
I actually use pnpm, but I doubt it has anything to do with this.
Steps to reproduce
Just call this controller to reproduce the bug.
Detailed Description
Seems that tsoa doesn't add on('error') handler to the stream. I can add my own, but I found no way to respond with error code. If I just log the error in the error handler, the request hangs indefinitely.