You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating an Automation via Python code for use with a webhook, it is created successfully and functions, but is not visible in the UI.
Sample create script:
importbase64fromprefect.automationsimportAutomationfromprefect.blocks.webhookimportWebhookfromprefect.eventsimportEventTrigger, CallWebhook, ResourceSpecificationfromprefect.typesimportSecretDictfrompydanticimportSecretStr# Define webhook URL and auth headerswebhook_url='http://example.com/api/webhook'basic_auth='luggage:12345'auth_secret=base64.b64encode(basic_auth.encode('utf-8')).decode('utf-8')
headers= {
"Authorization": f"Basic {auth_secret}",
"Content-Type": "application/json"
}
# Create Webhook Blockwebhook_block=Webhook(
url=SecretStr(webhook_url),
headers=SecretDict(headers),
verify=False# Set to True in production
)
# Save the webhook blockblock_id=webhook_block.save(name='test-webhook', overwrite=True)
print(f'Created WebhookBlock with ID: {block_id}')
asyncdefcreate_automation():
"""Create an automation that triggers on specific Prefect events"""automation=Automation(
name='test-webhook-automation',
trigger=EventTrigger(
expect={'prefect.flow-run.Completed', 'prefect.task-run.Running'},
match=ResourceSpecification.model_validate({
'prefect.resource.id': ['prefect.flow-run.*', 'prefect.task-run.*'],
}),
posture='Reactive'
),
actions=[CallWebhook(block_document_id=block_id, payload='{{ event.model_dump_json() }}')]
)
result=awaitautomation.acreate()
print(f"Created automation: {result.id}")
if__name__=='__main__':
importasyncioasyncio.run(create_automation())
The browser console displays the following error in the UI:
Error: Automation action type is missing case for: call-webhook
gKe index-XA97onRR.mjs:2988
map index-XA97onRR.mjs:31474
u automation.ts:14
map index-XA97onRR.mjs:31474
getAutomations automationsApi.ts:18
response vue-compositions.mjs:5397
run reactivity.esm-bundler.js:77
execute vue-compositions.mjs:5397
subscribe vue-compositions.mjs:5384
subscribe vue-compositions.mjs:5439
xn vue-compositions.mjs:5501
setup Automations.vue:48
Kx runtime-core.esm-bundler.js:199
_pe runtime-core.esm-bundler.js:7908
gpe runtime-core.esm-bundler.js:7868
ie runtime-core.esm-bundler.js:5216
te runtime-core.esm-bundler.js:5182
w runtime-core.esm-bundler.js:4700
Ot runtime-core.esm-bundler.js:5327
run reactivity.esm-bundler.js:225
fe runtime-core.esm-bundler.js:5454
ie runtime-core.esm-bundler.js:5230
te runtime-core.esm-bundler.js:5182
w runtime-core.esm-bundler.js:4700
Ot runtime-core.esm-bundler.js:5327
run reactivity.esm-bundler.js:225
fe runtime-core.esm-bundler.js:5454
ie runtime-core.esm-bundler.js:5230
te runtime-core.esm-bundler.js:5182
w runtime-core.esm-bundler.js:4700
Ot runtime-core.esm-bundler.js:5327
run reactivity.esm-bundler.js:225
fe runtime-core.esm-bundler.js:5454
ie runtime-core.esm-bundler.js:5230
te runtime-core.esm-bundler.js:5182
w runtime-core.esm-bundler.js:4700
H runtime-core.esm-bundler.js:4933
F runtime-core.esm-bundler.js:4855
L runtime-core.esm-bundler.js:4820
w runtime-core.esm-bundler.js:4688
Ot runtime-core.esm-bundler.js:5327
run reactivity.esm-bundler.js:225
fe runtime-core.esm-bundler.js:5454
registerDep runtime-core.esm-bundler.js:7202
promise callback*registerDep runtime-core.esm-bundler.js:7187
ie runtime-core.esm-bundler.js:5223
te runtime-core.esm-bundler.js:5182
w runtime-core.esm-bundler.js:4700
Ot runtime-core.esm-bundler.js:5406
run reactivity.esm-bundler.js:225
runIfDirty reactivity.esm-bundler.js:263
Kx runtime-core.esm-bundler.js:199
TY runtime-core.esm-bundler.js:408
promise callback*EY runtime-core.esm-bundler.js:322
K4 runtime-core.esm-bundler.js:336
cpe runtime-core.esm-bundler.js:7321
scheduler runtime-core.esm-bundler.js:6197
scheduler reactivity.esm-bundler.js:1830
trigger reactivity.esm-bundler.js:253
_9 reactivity.esm-bundler.js:311
notify reactivity.esm-bundler.js:597
trigger reactivity.esm-bundler.js:571
set value reactivity.esm-bundler.js:1456
J vue-router.mjs:3498
V vue-router.mjs:3363
promise callback*V vue-router.mjs:3330
R vue-router.mjs:3255
install vue-router.mjs:3699
use runtime-core.esm-bundler.js:3863
HNt colorMode.ts:23
<anonymous> main.ts:22
vue-compositions.mjs:5399:85
I think this is a difference between the two different Perfect versions (Prefect Server & Prefect Cloud). The Server (open source) UI supports the send-notification action with a custom webhook block rather than call-webhook.
Bug summary
When creating an Automation via Python code for use with a webhook, it is created successfully and functions, but is not visible in the UI.
Sample create script:
The browser console displays the following error in the UI:
Version info
Additional context
The frontend is successfully retrieving the JSON data via API:
But does not display anything in the UI:
The text was updated successfully, but these errors were encountered: