Closed lexcao closed 3 months ago
Hi @vroldanbet I just thought it is options forwarding thing but I am not familiar with the code base at the beginning. Is there any test case I can add?
@lexcao I've made client initialization simpler by making the option handle empty credentials JSON, which Spanner client does not handle well. I also added a test. Please have a look and make sure this works for you.
Hi @vroldanbet
Thanks for your suggestions, but it would not resolve the issue.
The key point is option.WithCredentialsJSON(config.credentialsJSON)
from Spanner,
which should skip adding that option if the credentialsJSON is nil.
The internal operation in the WithCredentialsJSON
method is making nil to empty slice of bytes
,
which would cause initialization error for Spanner with empty slice
@lexcao, you are right. I'd suggest removing my commit, and if anything adding a new commit only with the test. I'd also suggest opening a PR upstream spanner SDK to fix this annoying behaviour
Thanks, let me try to raise a PR for Spanner.
Hi @vroldanbet I just raised a PR in the upstream. https://github.com/googleapis/google-api-go-client/pull/2643 Waiting for review.
For now, I think we should add the fix for this, since it could break the use of CredentialsFile
for Spanner.
I have updated my code, you can review now.
I will make it more ergonomic after the upstream accepts my PR then.
Closes #1941 This is the follow-up PR for #1942, which fix the optional value issue.