Hey everyone, I'm having trouble configuring a tri...
# ask-community
y
Hey everyone, I'm having trouble configuring a trigger via YAML on my self-hosted Prefect server. My goal is to have the create_campaign_flow deployment trigger the trigger_backend_flow deployment when its flow run reaches the Completed state. When I configure the trigger through the Prefect UI using the built-in flow run state template, it works fine. However, when I set it up via YAML, the trigger appears in the UI but never fires. Here's the YAML snippet I'm using:
Copy code
deployments:
  - <<: *common_deployment
    name: create_campaign_flow
    entrypoint: ./src/flows/flow_automation.py:create_campaign_flow
  
  - <<: *common_deployment
    name: trigger_backend_flow
    entrypoint: ./src/flows/flow_automation.py:trigger_backend_flow
    triggers:
      - enabled: true
        match:
          prefect.resource.id: create_campaign_flow
        expect:
          - prefect.flow-run.Completed
        parameters:
          campaign_id: "{{ flow_run.parameters.campaign_id }}"
I’ve confirmed that each flow runs fine on its own, and the UI configuration for the trigger works as expected. Has anyone encountered a similar issue or have suggestions on what might be wrong with my YAML configuration? I’ve attached a screenshot of the UI trigger configuration as well. Any help is much appreciated!
n
hi @Yanay Sova
Copy code
create_campaign_flow
can you find a
prefect.flow-run.Completed
event in the event feed that's an example of what you're trying to event on? can you paste the raw tab here?
k
instead of using
match
, you can use
match_related
to filter for events that are related to your deployment, which includes state change events that happened as part of deployment runs
Copy code
match_related:
  prefect.resource.role: deployment
  prefect.resource.id: 
    - <the id of your create_campaign_flow deployment>
as in, expect the
prefect.flow-run.Completed
event from any resource related to
create_campaign_flow
upvote 1
y
Seems like switching to match_related and targeting prefect.resource.name did the trick! now the second flow is being triggered when the first flow finishes in complete state. Thanks for the help @Kevin Grismore @Nate 🙏
catjam 1