Marco Ruta
03/03/2025, 8:36 AM{{ flow_run.state.name }}
at {{ flow_run.state.timestamp }}.
Flow ID: {{ flow_run.flow_id }}
Flow run ID: {{ flow_run.id }}
Flow run URL: {{ flow_run|ui_url }}
State message: {{ flow_run.state.message }}
while in the block I left the body empty. On my webserver I'm getting an empty body.Marvin
03/03/2025, 8:36 AMjson.loads
. This is crucial for the automation to work correctly. Documentation Reference
2. Template Variables: Double-check the variables you're using in the template. Make sure they are correctly defined and available in the context where the template is rendered. Prefect's documentation doesn't list any specific issues with these variables, but ensuring they are correct and available is essential.
3. Empty Body Issue: There are no open GitHub issues specifically mentioning an empty body for notifications. This might indicate a configuration or rendering issue unique to your setup.
4. Prefect Variables: If you're using Prefect variables in your template, ensure they are correctly set and retrieved. Prefect variables are dynamically-named, mutable string values. They are not meant for sensitive data and should be used for configuration information. Documentation Reference
If you continue to experience issues, consider reviewing your template syntax and ensure that all variables are correctly passed and rendered. If the problem persists, it might be worth checking Prefect's GitHub for any updates or similar issues reported by other users.Marco Ruta
03/03/2025, 8:43 AMMarco Ruta
03/03/2025, 8:44 AMMarvin
03/03/2025, 8:44 AMjson
{
"flow_name": "{{ flow.name }}",
"flow_run_name": "{{ flow_run.name }}",
"state": "{{ flow_run.state.name }}",
"timestamp": "{{ flow_run.state.timestamp }}",
"flow_id": "{{ flow_run.flow_id }}",
"flow_run_id": "{{ flow_run.id }}",
"flow_run_url": "{{ flow_run|ui_url }}",
"state_message": "{{ flow_run.state.message }}"
}
Make sure to:
1. Validate JSON: Ensure that the JSON format is correct and that all placeholders are available in the context where the template is rendered.
2. Check Variables: Double-check that all variables (flow
, flow_run
, etc.) are correctly defined and accessible in your Prefect environment.
3. Use Jinja2: Remember that Prefect uses Jinja2 for rendering, so all standard Jinja2 syntax and features are available.
By defining your body in this structured manner, you should be able to resolve the issue of receiving an empty body on your webserver.Marco Ruta
03/03/2025, 8:48 AMMarvin
03/03/2025, 8:48 AMCustomWebhookNotificationBlock
is being treated as a string rather than a dictionary, which is required for validation. Here's how you can address this:
1. Ensure JSON Format: Make sure that your JSON body is correctly defined as a dictionary. The error suggests that it is being interpreted as a string. You might need to adjust how the JSON is being passed or rendered in your code.
2. Use Jinja2 Correctly: When using Jinja2 for rendering the JSON, ensure that the output is a valid dictionary. The rendered output should not be a string representation of the dictionary but an actual dictionary object.
3. Check Serialization: Prefect uses serializers to convert objects to and from bytes. Ensure that the JSON data is correctly serialized into a dictionary before it is passed to the CustomWebhookNotificationBlock
.
4. Prefect Blocks Documentation: You can refer to the Prefect Blocks Documentation for more details on how to correctly configure and use blocks like the CustomWebhookNotificationBlock
.
If you continue to face issues, consider checking how the JSON data is being constructed and passed in your automation script to ensure it aligns with the expected dictionary format.