Value cannot be null. Parameter name: baseUri

2.4k views Asked by At

I am using Google BigQuery API with Service Account Authorization in C# console application.

When i am trying to load CSV job, it throws "Value cannot be null. Parameter name: baseUri" Exception. It specific on only single table, when i am changing the table name it all gets work.

Here is the stack trace:

at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Google.Apis.Upload.ResumableUpload`1.<UploadCoreAsync>d__e.MoveNext() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis\Apis\[Media]\Upload\ResumableUpload.cs:line 459

Job Upload Code:

JobsResource.InsertMediaUpload InsertMediaUpload = new obsResource.InsertMediaUpload(BigQueryService, Job, Job.JobReference.ProjectId, fileStream, "application/octet-stream"); 
var JobInfo = InsertMediaUpload.UploadAsync();

HTTP Request & Response from Fiddler

Thanks.

1

There are 1 answers

0
selva kumar On BEST ANSWER

I manage to found the root cause and solution for my problem.

Actual Error: Table Schema getting Mismatched.

Reason: In Big Query table Field Mode is REQUIRED. I am getting table schema from Response of this query "Select * From Table-name Limit 1" because not able to build new schema. When i am getting table schema from query response the field mode changed into NULLABLE. That's why i am getting Schema Mismatch.

Questions to Google Developers:

  1. Why all the field mode is NULLABLE when we get the schema from Response?
  2. Why Google API does not return actual error, it just throw one common error statement, it gets annoying need fiddler to get the actual error, then how we will solve our Production issues. Need fiddler in production environment too? It does not make sense.

Developer Suggestion:

Use Fiddler tool to get actual error. In my case i am getting actual error from Textview under Inspectors Tab. Hope this post will helps too.

Thanks.