You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a long running Node.js application (think of a chat bot) that uses waku lightPush. Occasionally there are some uncaught rejections caught at the top-level when invoking waku.lightPush.send.
The problem with this that sending the message fails, but even though I have a try..catch around send the exception is generated at top level as an uncaught rejection. This indicates that there is a promise call somewhere under send which is rejected but the error is not handled, so it bubbles up.
It makes it very difficult to detect if sending fails so that it can be retried at the right context in the code. In Node.js you can install a top-level handler for unhandled rejections, but at that point there is missing context to what failed. Ideally the send function should not even generate exceptions, because its API returns an error if there were any, so it should capture all exceptions, including rejected promises.
The root cause of the problem seems to be the same as issue #1563 and I haven't seen it happening with @waku/sdk version 0.0.16, only with versions starting from 0.0.17.
Notes
@waku/sdk version 0.0.17, 0.0.18, 0.0.19 (the latest working that I tried was 0.0.16)
Node.js v18.17.1 on Linux
Connected to nwaku 0.18
Error: Failed to get a connection to the peer
at StreamManager.newStream (/home/attila/Projects/LogosLab/waku-objects-playground-bot/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@waku/core/src/lib/stream_manager.ts:52:13)
at StreamManager.prepareNewStream (/home/attila/Projects/LogosLab/waku-objects-playground-bot/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@waku/core/src/lib/stream_manager.ts:58:32)
at StreamManager.getStream (/home/attila/Projects/LogosLab/waku-objects-playground-bot/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@waku/core/src/lib/stream_manager.ts:37:10)
at LightPush.getStream (/home/attila/Projects/LogosLab/waku-objects-playground-bot/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@waku/core/src/lib/base_protocol.ts:40:31)
at <anonymous> (/home/attila/Projects/LogosLab/waku-objects-playground-bot/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@waku/core/src/lib/light_push/index.ts:107:33)
at Array.map (<anonymous>)
at LightPush.send (/home/attila/Projects/LogosLab/waku-objects-playground-bot/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@waku/core/src/lib/light_push/index.ts:105:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at sendMessage (/home/attila/Projects/LogosLab/waku-objects-playground-bot/src/lib/adapters/waku/waku.ts:117:20)
at safeSendMessage (/home/attila/Projects/LogosLab/waku-objects-playground-bot/src/lib/adapters/waku/bot.ts:343:12)
The text was updated successfully, but these errors were encountered:
I can see this test reproduces #1569 because of the following log line:
`(node:347036) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 12)`
Unfortunately, I was not able (yet) to make the test fail.
This is a bug report
Problem
I have a long running Node.js application (think of a chat bot) that uses waku lightPush. Occasionally there are some uncaught rejections caught at the top-level when invoking
waku.lightPush.send
.The problem with this that sending the message fails, but even though I have a try..catch around
send
the exception is generated at top level as an uncaught rejection. This indicates that there is a promise call somewhere undersend
which is rejected but the error is not handled, so it bubbles up.It makes it very difficult to detect if sending fails so that it can be retried at the right context in the code. In Node.js you can install a top-level handler for unhandled rejections, but at that point there is missing context to what failed. Ideally the
send
function should not even generate exceptions, because its API returns an error if there were any, so it should capture all exceptions, including rejected promises.The root cause of the problem seems to be the same as issue #1563 and I haven't seen it happening with
@waku/sdk
version 0.0.16, only with versions starting from 0.0.17.Notes
@waku/sdk version 0.0.17, 0.0.18, 0.0.19 (the latest working that I tried was 0.0.16)
Node.js v18.17.1 on Linux
Connected to nwaku 0.18
The text was updated successfully, but these errors were encountered: