Closed omerd-cyera closed 1 week ago
Would you like to create a PR for this issue?
Would you like to create a PR for this issue?
@kamilmysliwiec sure
@kamilmysliwiec Created the PR from another account
Let's track this here https://github.com/nestjs/nest/pull/13762
Is there an existing issue for this?
Current behavior
Receiving error events in the interceptor observer before all interceptors have been called triggers an unhandled promise rejection. I have attached a codesandbox link that shows this happening. Note that to get this behavior, we have to use something like
rxjs
smerge
.I ran into this issue when creating an interceptor that returns something like
merge(next.handle(), interval())
, and the interval throws before all the next.handle finish.Minimum reproduction code
https://codesandbox.io/p/devbox/nestjs-interceptor-unhandled-promise-rejection-forked-lj6l5p?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522cly769yn800072069cmwkqb57%2522%252C%2522sizes%2522%253A%255B60.578512396694215%252C39.421487603305785%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522cly769yn800022069kvmqvqso%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522cly769yn800042069iorhj886%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522cly769yn8000620690y7nu3vm%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522cly769yn800022069kvmqvqso%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cly769yn8000120698e3l0qgb%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252FREADME.md%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522cly76ap0n002n2069l9yw0fkz%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A11%252C%2522startColumn%2522%253A1%252C%2522endLineNumber%2522%253A11%252C%2522endColumn%2522%253A1%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252Fapp.module.ts%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522cly77c3wx00022069ds6j0qho%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A1%252C%2522startColumn%2522%253A1%252C%2522endLineNumber%2522%253A78%252C%2522endColumn%2522%253A1%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252Fapp.controller.ts%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522cly769yn800022069kvmqvqso%2522%252C%2522activeTabId%2522%253A%2522cly77c3wx00022069ds6j0qho%2522%257D%252C%2522cly769yn8000620690y7nu3vm%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cly769yn800052069k7ueutez%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522start%2522%252C%2522port%2522%253A3000%252C%2522path%2522%253A%2522%2522%257D%255D%252C%2522id%2522%253A%2522cly769yn8000620690y7nu3vm%2522%252C%2522activeTabId%2522%253A%2522cly769yn800052069k7ueutez%2522%257D%252C%2522cly769yn800042069iorhj886%2522%253A%257B%2522id%2522%253A%2522cly769yn800042069iorhj886%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cly769yn800032069740iyvsh%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%2522%257D%255D%252C%2522activeTabId%2522%253A%2522cly769yn800032069740iyvsh%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D
Steps to reproduce
It should trigger automatically when the integrated browser opens
Expected behavior
I would expect all subsequent exceptions after the first one to be either passed to the exception handling mechanism, or ignored.
Package
Other package
No response
NestJS version
10.3.2
Packages versions
Node.js version
v20.9.0
In which operating systems have you tested?
Other
The package.json and node version I specified are the ones in codesandbox. But it happens to me on node 18.17.0 and 10.3.0 too.
I think I know what the issue is. I managed to resolve it locally by patching
packages/core/interceptors/interceptors-consumer.ts:33
I replaced
with
When looking at this stackOverflow question: https://stackoverflow.com/questions/39319279/convert-promise-to-observable I followed
coderrr22
's warning on the accepted answer