Skip to content

Commit 9c63ae2

Browse files
committed
realtime stream error troubleshooting
1 parent 95eec5d commit 9c63ae2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/troubleshooting.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,21 @@ You could also offload the CPU-heavy work to a Node.js worker thread, but this i
273273

274274
If the above doesn't work, then we recommend you try increasing the machine size of your task. See our [machines guide](/machines) for more information.
275275

276+
### Realtime stream error (`sendBatchNonBlocking` / `S2AppendSession`)
277+
278+
Errors mentioning `sendBatchNonBlocking`, `@s2-dev/streamstore`, or `S2AppendSession` (often with `code: undefined`) can occur when you close a stream and then await `waitUntilComplete()`, or when a stream runs for a long time (e.g. 20+ minutes). Wrap `waitUntilComplete()` in try/catch so it doesn't fail your task:
279+
280+
```ts
281+
try {
282+
this.closeNodeUpdatesStream();
283+
await nodeUpdatesRealtime?.waitUntilComplete();
284+
} catch (err) {
285+
// Transport/closed-stream; log if needed
286+
}
287+
```
288+
289+
Alternatively, await `waitUntilComplete()` before closing the stream. See [Realtime Streams](/tasks/streams) for more.
290+
276291
## Framework specific issues
277292

278293
### NestJS swallows all errors/exceptions

0 commit comments

Comments
 (0)