Slackbot
07/22/2025, 3:10 PMMarvin
07/22/2025, 3:10 PMMarvin
07/22/2025, 3:10 PMMarvin
07/22/2025, 3:11 PMMarvin
07/22/2025, 3:11 PMpython
parameters=dict(
source_block="{{ prefect.blocks.serverwithpublickeyauthblock.esa-data-exchange-server }}",
),
2. Correct Syntax:
python
parameters=dict(
source_block="${{ prefect.blocks.serverwithpublickeyauthblock.esa-data-exchange-server }}"
),
The key differences are:
1. Use ${{ }}
instead of just {{ }}
for block references in deployment parameters
2. Make sure there are no spaces between the $
and the {{
This syntax is specifically required when programmatically creating deployments. The ${{ }}
syntax tells Prefect to resolve the block reference at runtime rather than trying to resolve it during deployment creation.
Also, to ensure everything is set up correctly:
1. Verify that your block is properly registered and available in your Prefect server/cloud
2. Double-check that the block name exactly matches what's in your Prefect server (including case sensitivity)
3. Ensure the block type slug matches exactly what's registered
If you're still getting the 422 error after making these changes, could you:
1. Confirm the exact name of your registered block as it appears in the UI
2. Share the full block type slug (you can get this by looking at the block in the UI)
This will help me provide more specific guidance if needed.Marvin
07/22/2025, 3:12 PMpython
transfer_files_flow.serve(
name=CONSTANTS.DEPLOYMENT_NAMES.TRANSFER_FILES_SOLSOC_TO_DATASTORE,
parameters=dict(
source_block={{ prefect.blocks.mycustomblock.some-name }}, # Remove the quotes
),
)
The reason for this is:
1. When you wrap the template expression in quotes, it's treated as a literal string rather than a template expression
2. The deployment service then tries to process "{{ prefect.blocks.mycustomblock.some-name }}"
as a literal string value, which isn't valid JSON (hence the 422 Unprocessable Entity error)
3. Without the quotes, the template expression is properly parsed and will be resolved at runtime to the actual block reference
Also, make sure that:
1. The block type slug ("mycustomblock") matches exactly what's registered in your Prefect server
2. The block name ("some-name") exists and is accessible
3. Your flow has the necessary permissions to access the block
If you're still getting errors after removing the quotes, please let me know and we can investigate further. It would be helpful to see the full error message in that case.