Cloudflare

Debugging Serverless Apps

Jul 5, 2018Steven Pack
Debugging Serverless Apps
SummaryAI, from the source post

This post introduces a debugging technique for Cloudflare Workers by implementing an interceptor pattern. This pattern allows for pre- and post-processing of requests, enabling the capture of log lines and exception information. A LogInterceptor is detailed, which collects log messages and, when triggered by an 'X-Debug' header or '?debug' query parameter, appends them as a URL-encoded string to the response header. A bash function for decoding this string is also provided.

More from the Edge Computing with Cloudflare Workers trail