Skip to content

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

@theGOTOguy

Description

@theGOTOguy

Environment details

  • OS: Alpine
  • Node.js version: 18.12.0
  • npm version: 8.19.2
  • @googleapis/google-auth-library-nodejs version: 8.7.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions