GoogleApiException: "Error response is null" - request to include status code in message
See original GitHub issueI have just encountered an exception with an error message that does not produce any Google search results. I am just testing my app for the first time after rewriting it to use Google Storage.
I don’t expect a resolution, but rather I’m posting here so other people encountering the error can at least get a search result for it.
The issue was repeatable. Each time I performed the same action in my app, it caused the error. However, that code is used in other actions and works. That is to say my call to GetBucketAsync()
works and then doesn’t work, depending on what I do in my app. It also caused my debugger to crash on GetBucketAsync()
and it felt like it crashed from just stopping on that line, not executing it but maybe I imagined that.
It’s all a bit strange. I’ll keep experimenting and update.
Environment details
- OS: macOS 12.2.1
- .NET version: 6.0.100
- Package name and version: Google.Cloud.Storage.V1, Version=3.6.0.0
Steps to reproduce
- Use the
StorageClient.GetBucketAsync(...)
method - Observe an error sometimes.
Stack trace is below.
The service storage has thrown an exception: Google.GoogleApiException: Error response is null
at Google.Apis.Services.BaseClientService.DeserializeError(HttpResponseMessage response)
at Google.Apis.Requests.ClientServiceRequest`1.ParseResponse(HttpResponseMessage response)
at Google.Apis.Requests.ClientServiceRequest`1.ExecuteAsync(CancellationToken cancellationToken)
at Google.Apis.Requests.ClientServiceRequest`1.ExecuteAsync()
at AcmeCorp.Coyote.Data.GoogleBlobs.GoogleIndexedObjectStore`1.GetBlobHeadsAsync(OpContext op) in /Users/lukepuplett/Documents/Git/Coyote/src/AcmeCorp.Coyote.Data/Coyote.Data.GoogleBlobs/GoogleIndexedObjectStore.cs:line 700
at AcmeCorp.Coyote.Data.GoogleBlobs.GoogleIndexedObjectStore`1.TryGetItemAndHeadAsync(OpContext op, String blobKey) in /Users/lukepuplett/Documents/Git/Coyote/src/AcmeCorp.Coyote.Data/Coyote.Data.GoogleBlobs/GoogleIndexedObjectStore.cs:line 293
at AcmeCorp.Coyote.Features.Capture.BoxItemDeleter.DeleteOutboxItemAsync(OpContext op, String itemKey) in /Users/lukepuplett/Documents/Git/Coyote/src/AcmeCorp.Coyote.Web.Capture.Guts/Coyote.Features.Capture/BoxItemDeleter.cs:line 40
at AcmeCorp.Coyote.Features.Capture.Coyote.Outbox.DeleteAsync(OpContext op, String itemKey) in /Users/lukepuplett/Documents/Git/Coyote/src/AcmeCorp.Coyote.Web.Capture.Guts/Coyote.Features.Capture.Coyote/Outbox.cs:line 125
at AcmeCorp.Coyote.Features.Capture.Coyote.Outbox.EnactAsync(Act act) in /Users/lukepuplett/Documents/Git/Coyote/src/AcmeCorp.Coyote.Web.Capture.Guts/Coyote.Features.Capture.Coyote/Outbox.cs:line 298
at AcmeCorp.Coyote.Features.Capture.CaptureCommandsImpl.EnactOutboxItemAsync(Act act) in /Users/lukepuplett/Documents/Git/Coyote/src/AcmeCorp.Coyote.Web.Capture.Guts/Coyote.Features.Capture/CaptureCommandsImpl.cs:line 277
at AcmeCorp.Coyote.Features.Capture.Coyote.CoyoteController.PostCaptureCommand(PostCaptureCommandFormModel formModel) in /Users/lukepuplett/Documents/Git/Coyote/src/AcmeCorp.Coyote.Web.Capture.Guts/Coyote.Features.Capture.Coyote/CoyoteController.cs:line 156
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
As an FYI I’ve sent #2067 for review which should address this issue and makes several improvements on error hadling. Some of the changes are breaking, but only if code was dependant on the exact error message, which was not very useful to start with.
Yes, that’s always a risk 😦 Hopefully, given how little information is in that, and that the status code is available, that won’t actually cause problems - but we’ll note it in release notes.