1

I have a cloudrun service deployed in asia-south1 region and would like to trigger it from eventarc when a message is published in pubsub.

However asia-south1 doesn't have eventarc, so I decided to create event arc trigger as location=global.

Below see below command.

    gcloud eventarc triggers create pubsub-trigger-new-auction-notification \
    --location=global \
    --destination-run-service=notification \
    --destination-run-path=/notify/bidder/auction \
    --destination-run-region=asia-south1 \
    --event-filters="type=google.cloud.pubsub.topic.v1.messagePublished" \
    --transport-topic=projects/<my-project_id>/topics/newauction-notify \
    --service-account=cloud-run-pubsub-invoker@<my-project_id>.iam.gserviceaccount.com

However it fails with below error mentioning that type should be google.cloud.audit.log.v1.written

ERROR: (gcloud.eventarc.triggers.create) INVALID_ARGUMENT: The request was invalid: [INVALID_ARGUMENT] The request was invalid: invalid value for attribute 'type' in trigger.event_filters: only type "google.cloud.audit.log.v1.written" is allowed in global location

When I try to create trigger with google.cloud.audit.log.v1.written It fail with missing service name error. Please see below

ERROR: (gcloud.eventarc.triggers.create) INVALID_ARGUMENT: The request was invalid: [INVALID_ARGUMENT] The request was invalid: missing required attribute "serviceName" in trigger.event_filters

I could not seem to find any documentation which mentions about global trigger with pubsub and cloud run. Can somebody please help me to understand how to link a pubsub based event trigger to cloud run when event arc location is global or point me to right direction?

Thanks

Neeraj Kumar
  • 836
  • 1
  • 10
  • 29

1 Answers1

0

You can set the location that you want where eventarc is supported. The "issue" that you will have is you will pay for the inter-region traffic. that's all.


As workaround, you need to know how work EventArc. it create, under the hood (but you can see that in your project) a pubsub push subscription to call your Cloud Run service at the specified URL.

You can create manually this push subscription and wait for an eventarc availability in your region.

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • Thanks guillaume blaquiere. Creating trigger in another region certainly helped. I misunderstood documentation and thought global should be used for eventarc trigger if destination run region doesn't support event arc. I previously looked for push subscription, If I am not wrong, that requires my cloud run service to be up always to receive push event from pubsub., which I am trying to avoid currently. – Neeraj Kumar Aug 08 '21 at 23:52
  • As I said, EventArc create a PubSub subscription. Therefore if the Cloud Run service doesn't exist, a HTTP 404 error code is received by PubSub subscription. The message isn't acknowledged and is kept and retried up to 7 days. After, the message is deleted. Standard pubSub behavior. – guillaume blaquiere Aug 09 '21 at 07:32