How to debug edge functions on Data Stream

The debugging process in edge functions’ code on Data Stream helps you identify if errors are still occurring or if the process was successful.

Before analyzing the process, you need to apply the debugging code. Find out more on Debugging edge functions.

Setting up Data Stream to debug edge functions

Section titled Setting up Data Stream to debug edge functions

After applying the debugging code for edge functions:

  1. Access Azion Console.
  2. On the upper-left corner, select Data Stream on the Observe section.
  3. Click + Stream.
  4. Choose a name for your stream.
  5. On the Source dropdown menu, select Edge Functions.
  6. On the Template dropdown menu, select Edge Functions Event Collector.
  7. On the Data Set code box, add the following variables:
{
"time": "$time",
"global_id": "$global_id",
"edge_function_id": "$edge_function_id",
"request_id": "$request_id",
"log_level": "$log_level",
"log_message": "$log_message"
}
  1. On Domains > Options, select between All Current and Future Domains or Filter Domains. See more about each option on How to associate domains on Data Stream.
  2. On the Destination section, select a Connector on the dropdown menu. See more about setting an endpoint.
    • You’ll see different fields depending on the connector type you choose.

Finally, to finish your stream setup:

  1. Make sure the Active switch is turned on.
  2. Click the Save button.

Now, you’ll be able to analyze the behavior of the edge functions debugging process through the logs sent to your configured stream.

VariableDefinition
$timeRequest date and time. Example: Oct. 31st, 2022 - 19:30:41
$global_idSettings identifier.
$edge_function_idEdge Function identifier.
$request_idUnique request identifier. Example: 5f222ae5938482c32a822dbf15e19f0f
$log_levelLevel of the log generator: ERROR, WARN, INFO, DEBUG, or TRACE.
$log_messageEditable message used in the log function. Available for users to identify and report a given behavior.

Contributors