Skip to content

Commit ece8995

Browse files
irvinebroquemaheshwarip
authored andcommitted
[Workers] Reference no-floating-promises eslint rule (#16843)
hat tip @threepointone
1 parent 6e5927c commit ece8995

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/content/docs/workers/observability/errors.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export default {
6060
};
6161
```
6262

63+
You can prevent this by enforcing the [`no-floating-promises` eslint rule](https://typescript-eslint.io/rules/no-floating-promises/), which reports when a Promise is created and not properly handled.
64+
6365
#### Cause 2: WebSocket connections that are never closed
6466

6567
If a WebSocket is missing the proper code to close its server-side connection, the Workers runtime will throw a `script will never generate a response` error. In the example below, the `'close'` event from the client is not properly handled by calling `server.close()`, and the error is thrown. In order to avoid this, ensure that the WebSocket's server-side connection is properly closed via an event listener or other server-side logic.

0 commit comments

Comments
 (0)