Reputation: 6999
Setup:
That all works normally. Now, I know of two options to simulate an event (other than rewriting files which is not "simulating" and not acceptable for this case):
It's straightforward to publish a message to the Eventarc trigger's topic. However, whenever I do that, the payload that arrives at the cloud run service is an envelope wrapping a base64 encoded payload. Eventarc is somehow avoiding that envelope because when it triggers, the payload is just the CloudEvents JSON. Is there some setting in the PubSub API to get rid of this envelope or something?
The problem here is that it is a google sourced event. So there is no channel. But the API requires a channel to be specified. I tried various formats for the channel but could find nothing that worked. The one possibility is if I set the channel to "google" then I get a 403 permission denied on resource project google.
If that is supposed to work, exactly what permissions are required? The docs mention eventarc.publisher
which I granted but perhaps I missed giving it to the correct service account?
Upvotes: 0
Views: 123
Reputation: 6999
I realized that the answer is don't bother trying to simulate the same event. Just create a different eventarc that listens on a pubsub topic and publish to that. Unfortunately, it still has the message wrapped in an envelope when it calls the service, so I had to create a separate endpoint that unwraps the envelope.
Upvotes: 0