We currently mount the keyfile into the k8s pod as a secret. We couldn't understand why we kept getting email is required. It took way too much time to figure out that this library expects a json keyfile to be named json (https://github.com/stephenplusplus/google-auto-auth/blob/b87976f5726f7642ccaff70042b179311ac9b65b/index.js#L54-L61). Secrets in k8s are typically just a filename without the extension, so this lib apparently thought we passed a path to a pem file, and gave us odd stacktraces with JWT stuff.
The point of this issue: Could either the docs be clarified about this implementation detail, or separate options for json keyfile and pem files be added?
As a bonus: if keyFilename points to a non-existent path, the same error (email is required) is thrown at the time of trying to talk to the API. IMO, an error saying that the file doesn't exist should be thrown during initialization 😄
We currently mount the keyfile into the k8s pod as a secret. We couldn't understand why we kept getting
email is required
. It took way too much time to figure out that this library expects a json keyfile to be named json (https://github.com/stephenplusplus/google-auto-auth/blob/b87976f5726f7642ccaff70042b179311ac9b65b/index.js#L54-L61). Secrets in k8s are typically just a filename without the extension, so this lib apparently thought we passed a path to a pem file, and gave us odd stacktraces with JWT stuff.Our diff to fix it, for posterity:
The point of this issue: Could either the docs be clarified about this implementation detail, or separate options for json keyfile and pem files be added?
As a bonus: if
keyFilename
points to a non-existent path, the same error (email is required
) is thrown at the time of trying to talk to the API. IMO, an error saying that the file doesn't exist should be thrown during initialization 😄