Enable Continue on error

You can use Continue on error to let requests continue processing to the next step even if one of the following EdgeWorkers event handlers fails or returns an error.

  • onOriginRequest
  • onOriginResponse
  • onClientResponse
  • onClientRequest

👍

You can apply Continue on error to an EdgeWorker that implements multiple event handlers. If one event handler fails, the remaining event handlers, except responseProvider, will continue to execute as the request proceeds.

This topic outlines the steps to enable Continue on error, included as an option in the EdgeWorkers behavior. It also describes how to view the logs generated by Continue on error using DataStream 2 logs.

Response Provider

The responseProvider event handler is not supported with continue on error.

  • If responseProvider fails, the request returns an HTTP 500 Internal Server Error to the client.
  • If an EdgeWorker using continue on error implements both onClientRequest and responseProvider, and there is an error in onClientRequest, then the request will skip the responseProvider event.

🚧

If a responseProvider event is skipped due to an error in onClientRequest, then the request will proceed to the next step as if responseProvider was not defined in the EdgeWorker.

This may not be the desired behavior, and you should consider using Site Failover which implements responseProvider instead of Continue on Error.

Site Failover and Continue on error

Site Failover for EdgeWorkers and Continue on error should not be configured to apply on the same request.

👍

If you want to retry the request when an EdgeWorker error occurs, use Site Failover. If you want the request to continue to the next step in the request when an EdgeWorkers error occurs, use Continue on error.

Site Failover triggers a new request flow whereas Continue on error allows the original request flow to continue. You should use Continue on error if you want to:

  • Let the request continue to the next step without applying the business logic coded in the EdgeWorker.
  • Investigate the reason for an EdgeWorkers failure at a later date and let the main request continue.
  • Use other Property Manager behaviors to gather data from the end-user such as, geo-location and cookies for the main, non-EdgeWorkers workflow.
    • Site Failover triggers a new request. When the new request occurs the end-user data may be lost. If, on the other hand, the end-user data is preserved and passed on this process may not adhere to the laws regarding the use of Personally identifiable information (PII).

For more information about when to use Site Failover instead, go to the Configure Site Failover topic in this guide.

Enable Continue on error

You can enable Continue on error when you Add the EdgeWorker behavior in Property Manager.

When Continue on error is enabled, a failed EdgeWorkers execution will not stop the main request from continuing onto the next processing stages.

Make sure that Site Failover isn't configured for EdgeWorkers on your property before you enable Continue on error.

Use DataStream 2 to view Continue on error log details

The Continue on error log details are available in the DataStream 2 stream logs. You can configure your stream to deliver the logs to a supported stream destination.

Follow the steps in Configure a Delivery stream.

Continue on error logging details

The Continue on error field logs Continue on Error related messages. For more information, see the EdgeWorkers usage logs.

//[EdgeWorker-Id]/[Version]/[Event Handler]/[Off
Reason]/[Logic Executed]/[Status]/[RevisionId]/[OverJavaScriptLogLimit]/[Continue on error]/#[Metrics]


Possible values for the Continue on Error field include:

0 – Off: Feature not enabled in Property Manager.
1 – Enabled: Feature is enabled but no error triggered.
2 – Unable to continue (streaming started): could not proceed once streaming began.
3 – Continuing: Continue on error is active, a handler fails, and the request continues execution.
4 – Unable to continue for other reasons: Indicates continue on error is enabled but could not complete.