Widgets/Custom

Edge Function Widget

Edge Function Widget

A "Custom" type widget. Edge Function Widget allows you to invoke external functions when your recipe is exported to the edge. This widget provides a way to call custom functions that have been registered with the edge function manager, enabling you to extend recipe functionality with custom logic.

The widget receives data through its input port, passes it as parameters to the registered edge function, and outputs the function's result. The function name must be configured in the widget's custom settings before use.

 

Functionality

When data arrives at the params input port, the Edge Function widget:

  1. Retrieves the configured function name from its state
  2. Invokes the registered edge function with the input data as parameters
  3. Determines the data type of the result automatically
  4. Outputs the result through the result output port

The widget will only process data if a function name has been configured. If no function is registered for the specified name, the widget will not produce any output.

 

Inputs

  • params (DataType: Anything) The input data that will be passed to the edge function as parameters. This can be any supported data type (Number, String, Boolean, Object, Array, etc.).

 

Outputs

  • result (DataType: Anything) The result returned from the edge function. The data type is automatically determined based on the function's return value. If the function returns null or undefined, no output will be emitted.

 

Custom Settings

This widget requires configuration through its custom settings to specify which edge function to invoke.

  • Function Name — The name of the registered edge function to invoke. This must match the name used when registering the function handler. The function name is displayed on the widget in the workspace.

Function Name Setting



Usage Notes

  • The edge function must be registered before the widget can successfully invoke it
  • If a function name is not configured, the widget will not process any input data
  • The widget automatically handles data type conversion for the result
  • Edge functions are typically used when recipes are deployed to edge environments

 

Drag the example onto the workspace to explore and experiment!