Skip to content

keyFilename requires .json extension if credentials file is of JSON type - docs #1717

@simonfan

Description

@simonfan

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: v1
kind: Secret
metadata:
  name: some-secret
type: Opaque
data:
  # will be available as a file /path/to/secret/gcp-keyfile
  gcp-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..)

Might be related to #768

Metadata

Metadata

Labels

type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions