Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful/Misleading Error Message when Credentials File is Empty #2154

Closed
theGOTOguy opened this issue Mar 2, 2023 · 2 comments
Closed
Labels
api: storage Issues related to the googleapis/nodejs-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@theGOTOguy
Copy link

Environment details

  • OS: Alpine
  • Node.js version: 18.12.0
  • npm version: 8.19.2
  • @google-cloud/storage version: 6.9.0

Steps to reproduce

  1. Create an empty gcp_credentials.json file for your gcloud_project with your gcloud_storage_bucket.
  2. Use, e.g.:
  const storage = new Storage({
      projectId: gcloud_project,
      keyFilename: 'gcp_credentials.json'
  });

  const bucket = storage.bucket(gcloud_storage_bucket);
  const [metadata] = await bucket.getMetadata();
  1. Receive unhelpful error message "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type boolean (true)"

It would be reasonable to sanity-check the key file and return a more illuminating error message.

@theGOTOguy theGOTOguy added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 2, 2023
@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Mar 2, 2023
@ddelgrosso1
Copy link
Contributor

@theGOTOguy handling of credentials / credentials files is done by https://github.com/googleapis/google-auth-library-nodejs. This issue should be opened there.

@theGOTOguy
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants