简体   繁体   中英

Google.Cloud.Speech Received http2 header with status: 404

I'm using the C# Google.Cloud.Speech.V1 .NET client library version 2.0.0 for the Google Cloud Speech API .

I want to get the operation status of a longRunningRecognize with OperationsClient :

var operationsClient = new OperationsClientBuilder { CredentialsPath = "GoogleServiceAccount.json" }.Build();
var operation = operationsClient.GetOperation("3637912932635009144");

But Im getting this Exception:

Grpc.Core.RpcException: Status(StatusCode=Cancelled, Detail="Received http2 header with status: 404")

I've use SpeechClient and a StorageClient with the ServiceAccount credentials (GoogleServiceAccount.json) and everything works fine.

I've verified the Operations with Google Cloud SDK Shell and is fine too:

gcloud ml speech operations describe 3637912932635009144

Any help would be greatly appreciated.

Here's the StackTrace:

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Grpc.Core.Internal.AsyncCall`2.UnaryCall(TRequest msg)
   at Grpc.Core.Calls.BlockingUnaryCall[TRequest,TResponse](CallInvocationDetails`2 call, TRequest req)
   at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
   at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext`2 ctx)
   at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorContext`2 context, BlockingUnaryCallContinuation`2 continuation)
   at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
   at Google.LongRunning.Operations.OperationsClient.GetOperation(GetOperationRequest request, CallOptions options)
   at Google.Api.Gax.Grpc.ApiCall.GrpcCallAdapter`2.CallSync(TRequest request, CallSettings callSettings)
   at Google.Api.Gax.Grpc.ApiCallRetryExtensions.<>c__DisplayClass1_0`2.<WithRetry>b__0(TRequest request, CallSettings callSettings)
   at Google.Api.Gax.Grpc.ApiCall`2.<>c__DisplayClass10_0.<WithCallSettingsOverlay>b__1(TRequest req, CallSettings cs)
   at Google.Api.Gax.Grpc.ApiCall`2.Sync(TRequest request, CallSettings perCallCallSettings)
   at Google.LongRunning.OperationsClientImpl.GetOperation(GetOperationRequest request, CallSettings callSettings)
   at Google.LongRunning.OperationsClient.GetOperation(String name, CallSettings callSettings)
   at TranscripcionAPI.Controllers.WeatherForecastController.GetResult(String operationName) in C:\Users\andresfelipe\source\repos\TranscripcionAPI\TranscripcionAPI\TranscripcionAPI\Controllers\WeatherForecastController.cs:line 146

I posted an issue about this on github.

I was using the library the wrong way.

The correct way to query an operation is:

var speech = new SpeechClientBuilder { CredentialsPath = "GoogleServiceAccount.json" }.Build();
var operation = speech.PollOnceLongRunningRecognize(operationName);

You can see the answer here:

https://github.com/googleapis/google-cloud-dotnet/issues/4843

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM