Enhanced debug headers

EdgeWorkers supports enhanced request-level debugging via an additional Akamai-EW-Trace request header.

Enhanced debug headers include the execution times and status message associated with each event handler in addition to the standard debugging information. To receive enhanced debugging information about the EdgeWorkers execution in the debug response headers the request must pass both:

  • An Akamai-EW-Trace request header that contains a secure authentication token. See the Enable enhanced debug headers section for more information.
  • One of the standard Pragma headers. See the Standard Debug Headers section for more information.
  • For responseProvider you need to add the Pragma akamai-x-ew-debug-rp header that enables the multi-part response header. See for Enable and view JavaScript Logging for more information.
Here’s an example of a request header:
curl http://www.example.com -H 'Pragma: akamai-x-ew-debug' -H 'Akamai-EW-Trace: exp=1600166650~acl=/*~hmac=db4018160fab828da87d3fd8685bfbb9e0f1020885a9cce9403bcf3f5182477d' -k -sD - -o /dev/null
This example shows the trace response headers with successful execution of all event handlers:
HTTP/1.1 302 Moved Temporarily
Location: /us/en/
Content-Type: text/html
Content-Length: 0
Date: Tue, 10 Sep 2019 02:31:17 GMT
Connection: keep-alive
X-Akamai-EdgeWorker-onClientResponse-Info: ew=9 v7.0:EW for example.com; status=Success; status_msg=-; wall_time=0.100; cpu_time=0.098; memory_usage=2464
X-Akamai-EdgeWorker-onClientRequest-Info: ew=9 v7.0: EW for example.com; status=Success; status_msg=-; wall_time=0.075; cpu_time=0.068; memory_usage=229836
X-Akamai-EdgeWorker-onOriginResponse-Info: ew=9 v7.0:EW for example.com; status=Success; status_msg=-; wall_time=0.068; cpu_time=0.058; memory_usage=1036
X-Akamai-EdgeWorker-onOriginRequest-Info: ew=9 v7.0: EW for example.com; status=Success; status_msg=-; wall_time=0.100; cpu_time=0.098; memory_usage=2664
X-Akamai-EdgeWorker-ResponseProvider-Info: ew=9 v7.0: EW for example.com; status=Success; status_msg=-; wall_time=0.100; cpu_time=0.098; memory_usage=1740
X-Powered-By: Akamai EdgeWorkers
Here's a curl request that passes the Pragma akamai-x-ew-onclientrequest response header:
curl "http://www.example.com" -H "Pragma: akamai-x-ew-onclientrequest" -H 'Akamai-EW-Trace: exp=1600166650~acl=/*~hmac=db4018160fab828da87d3fd8685bfbb9e0f1020885a9cce9403bcf3f5182477d' -k -sD - -o /dev/null
This example shows the trace response header with an execution error:
HTTP/1.1 500 Internal Server Error
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 174
Expires: Thu, 12 Sep 2019 15:11:24 GMT
Date: Thu, 12 Sep 2019 15:11:24 GMT
Connection: close
X-Akamai-EdgeWorker-onClientRequest-Info: ew=9 v7.0:EW for example.com; status=ExecutionError; status_msg=main.js:runtime_error:5:2,main.js:red_team:16:3,main.js:onClientRequest:39:3+ReferenceError:+calling_undefined_fn+is+not+defined; wall_time=0; cpu_time=0; memory_usage=21560

The EdgeWorker trace response header value currently contains EdgeWorker details, the error type, an error message, the wall and CPU time. The trace header format will be updated as new fields are added to the response.

Response Header fields Details Description
EdgeWorker details

ew=<id> v<version>:<name>
<id> EdgeWorker ID
<version> EdgeWorker version number
<name> EdgeWorker name
Status type

status=<status type>
<status type> Possible values include:
  • Success - the EdgeWorker successfully executed.
  • GenericError - a compile error, such as a syntax error occurred.
  • ExecutionError - an execution error, such as a JavaScript exception or error occurred.
  • RuntimeError - an error occurred at runtime/environment preventing the EdgeWorker from executing.
  • UnknownEdgeWorker - the EdgeWorker ID cannot be loaded because it doesn't exist.
  • UnimplementedHandler - the requested event handler wasn't implemented by the EdgeWorker.
  • TimeoutError - the execution time surpassed an upper limit restriction.
  • WallTimeoutError - the wall time consumed by the event handler exceeded the limit during the JavaScript execution.
  • InitWallTimeoutError - the wall time consumed by the event handler exceeded the limit during the JavaScript initialization.
  • CpuTimeoutError - the amount of CPU time consumed by the event handler exceeded the limit during the JavaScript execution.
  • InitCpuTimeoutError - the amount of CPU time consumed by the event handler exceeded the limit during the JavaScript initialization.
  • ResourceLimit - the upper bound of a resource limit was reached.
Status Message

status_msg=(<filename>:<function-name>:<line-number>:<column>)+ <error-description>
<function-name> Optional URL encoded function name where the error occurred.
<line-number> Optional line number where the error occurred.
<column> Column number where the error occurred.
<error-description> Error message for the exception.
Wall Time

wall_time=<wall_time>
<wall_time> The total amount of time consumed by the event handler in milliseconds.
CPU Time

cpu_time=<cpu_time>
<cpu_time> The amount of CPU time consumed by the event handler in milliseconds.
Memory Usage

memory_usage=<memory_usage>
<memory_usage> The amount of memory consumed by the event handler in bytes.