I have long audio files, and as suggested here -
it writes transcription results to a bucket. Then I use Storage Event triggers to invoke a Cloud Function when the operation is successful.
But I also want to invoke a different function when the transcription operation fails.
What are my options?
Are there events from Eventarc that can notify about failure of a long-running operation in Speech API?
Hi @maxhr2,
Welcome to Google Cloud Community!
You can try creating a criteria for cloud logs which will serve as the event trigger to your cloud function (e.g. you set it to failed to upload to a bucket), when the transcription result is failed to upload in your cloud storage bucket, it will trigger your cloud function since it served as a notification to the cloud function. Here is a sample code on how to trigger a function from cloud logging: https://cloud.google.com/functions/docs/samples/functions-log-stackdriver#functions_log_stackdriver-... You can also try using Pub/Sub as the event trigger, you can return the operation to the client and pass the operation resource to get the response which is the Pub/Sub API , then it will serve as the trigger to your cloud function. You can check this link for more information: https://cloud.google.com/speech-to-text/docs/reference/rpc/google.longrunning#operations
Here is a sample code: https://cloud.google.com/functions/docs/samples/functions-cloudevent-pubsub
For more information about the event triggers for cloud functions, you can check this link: https://cloud.google.com/functions/docs/calling#2nd-gen-triggers
https://cloud.google.com/functions/docs/samples/functions-v2-full
Hope this helps!
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |