You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using keyFilename upon initialization to specify the filename of JSON credentials, the .json extension seems to be required, otherwise the file will be interpreted as of another format.
My use case was when storing the gcp-keyfile.json in a Kubernetes secret:
apiVersion: v1kind: Secretmetadata:
name: some-secrettype: Opaquedata:
# will be available as a file /path/to/secret/gcp-keyfilegcp-keyfile: d2hhdGV2ZXIK...
When using that keyFilename, an error would be thrown: Error: could not authorize request email is required, because google-cloud did not recognize the key as being of JSON type (I guess). Is that right?
The only way of solving the problem was to change the gcp-keyfile to gcp-keyfile.json
Now that I've solved my issues with that it seems quite intuitive (almost obvious I'd say) that the .json extension is important, but I've wasted some hours not understanding why the error was happening.
I think it might be important to make this clearer in the documentation in some way (I'd make a pr but do not understand the auth process so well..)
I can completely sympathize with spending a lot of time on an issue, only to realize it was something simple. I'm sorry you had to go through that, but I'm glad everything is working properly now! I went to our docs and saw that we say "config.keyFilename - string - Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console." If you can find a way to improve our docs, or if someone else sees this and went through the same, please send us a PR!
I'm so glad this issue existed, it just saved me more hours of debugging. This is exactly the same issue I had, and the fix was to add the JSON filename extension.
I ran into the same thing just now. While I appreciate the addition to the documentation, the README is what I usually consult for a quick reference, and it doesn't say anything about it. Even more confusing is the fact that if you specify a path to a file that does not have the .json extension, but is still a valid key, you get cryptic errors such as Error: Getting metadata from plugin failed with error: email is required., which wasn't really pointing me in the right direction to figure this one out.
When using
keyFilename
upon initialization to specify the filename of JSON credentials, the.json
extension seems to be required, otherwise the file will be interpreted as of another format.My use case was when storing the
gcp-keyfile.json
in a Kubernetes secret:When using that keyFilename, an error would be thrown:
Error: could not authorize request email is required
, because google-cloud did not recognize the key as being of JSON type (I guess). Is that right?The only way of solving the problem was to change the
gcp-keyfile
togcp-keyfile.json
Now that I've solved my issues with that it seems quite intuitive (almost obvious I'd say) that the
.json
extension is important, but I've wasted some hours not understanding why the error was happening.I think it might be important to make this clearer in the documentation in some way (I'd make a pr but do not understand the auth process so well..)
Might be related to #768
The text was updated successfully, but these errors were encountered: