Skip to content

Commit 9c27bda

Browse files
Ankcornkodster28
andauthored
Improve workers errors documentation (#21982)
* add outcome values to the workers_trace_events docs * improve the workers observability errors documentation * improve the workers observability errors documentation * try to fix the link * the trace item schema is updated automatically * Update src/content/docs/workers/observability/errors.mdx Co-authored-by: Kody Jackson <[email protected]> --------- Co-authored-by: Thomas Ankcorn <[email protected]> Co-authored-by: Kody Jackson <[email protected]>
1 parent 610468e commit 9c27bda

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

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

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,39 @@ To review whether your application is experiencing any downtime or returning any
242242
2. In **Account Home**, select **Workers & Pages**.
243243
3. In **Overview**, select your Worker and review your Worker's metrics.
244244

245-
A `responseStreamDisconnected` event `outcome` occurs when one end of the connection hangs up during the deferred proxying stage of a Worker request flow. This is regarded as an error for request metrics, and presents in logs as a non-error log entry. It commonly appears for longer lived connections such as WebSockets.
245+
### Worker Errors
246246

247-
## Debug exceptions
247+
The **Errors by invocation status** chart shows the number of errors broken down into the following categories:
248248

249-
After you have identified your Workers application is returning exceptions, use `wrangler tail` to inspect and fix the exceptions.
249+
| Error | Meaning |
250+
| -------------------------- | --------------------------------------------------------------- |
251+
| `Uncaught Exception` | Your Worker code threw a JavaScript exception during execution. |
252+
| `Exceeded CPU Time Limits` | Worker exceeded CPU time limit or other resource constraints. |
253+
| `Exceeded Memory` | Worker exceeded the memory limit during execution. |
254+
| `Internal` | An internal error occurred in the Workers runtime. |
250255

251-
{/* <!-- TODO: include example --> */}
256+
The **Client disconnected by type** chart shows the number of client disconnect errors broken down into the following categories:
257+
258+
| Client Disconnects | Meaning |
259+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
260+
| `Response Stream Disconnected` | Connection was terminated during the deferred proxying stage of a Worker request flow. It commonly appears for longer lived connections such as [WebSockets](/workers/runtime-apis/websockets/). |
261+
| `Cancelled` | The Client disconnected before the Worker completed its response. |
262+
263+
## Debug exceptions with Workers Logs
264+
265+
[Workers Logs](/workers/observability/logs/workers-logs) is a powerful tool for debugging your Workers. It shows all the historic logs generated by your Worker, including any uncaught exceptions that occur during execution.
266+
267+
To find all your errors in Workers Logs, you can use the following filter: `$metadata.error EXISTS`. This will show all the logs that have an error associated with them. You can also filter by `$workers.outcome` to find the requests that resulted in an error. For example, you can filter by `$workers.outcome = "exception"` to find all the requests that resulted in an uncaught exception.
268+
269+
All the possible outcome values can be found in the [Workers Trace Event](/logs/reference/log-fields/account/workers_trace_events/#outcome) reference.
270+
271+
## Debug exceptions from `Wrangler`
272+
273+
To debug your worker via wrangler use `wrangler tail` to inspect and fix the exceptions.
252274

253275
Exceptions will show up under the `exceptions` field in the JSON returned by `wrangler tail`. After you have identified the exception that is causing errors, redeploy your code with a fix, and continue tailing the logs to confirm that it is fixed.
254276

255-
## Set up a logging service
277+
## Set up a 3rd party logging service
256278

257279
A Worker can make HTTP requests to any HTTP service on the public Internet. You can use a service like [Sentry](https://sentry.io) to collect error logs from your Worker, by making an HTTP request to the service to report the error. Refer to your service’s API documentation for details on what kind of request to make.
258280

0 commit comments

Comments
 (0)