Enable and view JavaScript logging for responseProvider

JavaScript logging for the responseProvider event handler includes a multi-part response. It consists of the expected response body followed by an additional section that contains the responseProvider debug fields.

With streamed responses, this information is not available until the event handler ends.
Note: For responseProvider you need to add the Pragma akamai-x-ew-debug-rp header that enables the multi-part response header.
Note: If the responseProvider event handler is not implemented, a status of UnimplementedEventHandler will appear in the standard trace header.

How to

  1. Use the instructions in Enable enhanced debug headers to add the built-in log module to your EdgeWorkers function.
  2. Here’s a curl request that adds the Pragma akamai-x-ew-debug-rp multi-part response header and the Akamai-EW-Trace header to retrieve the JavaScript logging information:
    curl -i 'http://www.example.com/ -H 'Pragma: akamai-x-ew-debug-rp' -H 'Akamai-EW-Trace: exp=1600166650~acl=/*~hmac=db4018160fab828da87d3fd8685bfbb9e0f1020885a9cce9403bcf3f5182477d'
    In the multi-part response output below, the original body is separated from the trailing debug information by the j50cx0rLZHkfMieMHdE7HM randomized boundary string.
    HTTP/1.1 200 OK
    Content-Type: multipart/form-data; boundary=j50cx0rLZHkfMieMHdE7HM
    content-disposition: attachment
    Date: Thu, 22 Oct 2020 19:08:18 GMT
    Content-Length: 1871
    Connection: keep-alive
    X-Akamai-EdgeWorker-onClientResponse-Info: ew=[EdgeWorker ID] v1.0:Example; status=Success; status_msg=-; wall_time=0.037; cpu_time=0.037; sc_ver=2.15.14; pearl_ver=2.0.1; ew_exe_ip=; heap_usage=0
    X-Akamai-EdgeWorker-onClientRequest-Info: ew=[EdgeWorker ID] v:Example; status=UnimplementedEventHandler; sc_ver=; pearl_ver=2.0.1; ew_exe_ip=
    X-Powered-By: Akamai EdgeWorkers
    content-type: application/json
    content-disposition: form-data; name="response-provider-body"
    {"endPoint1":{"manifest1":{ ... }},"endPoint2":{"manifest2":{ ... }},"endPoint3":{"manifest3":{ ... }}}
    content-type: text/plain;charset=UTF-8
    content-disposition: form-data; name="stream-trace"
    X-Akamai-EdgeWorker-ResponseProvider-Info: ew=[EdgeWorker ID] v1.0:Example; status=Success; status_msg=-; wall_time=18.921; cpu_time=5.892
    X-Akamai-EdgeWorker-responseProvider-Log: D:main.js:40 SubRequests Completed - Resulting JSON {"endPoint1":{"manifest1":{ ... }},"endPoint2":{"manifest2":{ ... }},"endPoint3":{"manifest3":{ ... }}}