googleapis / googleapis/google-cloud-node

Unhelpful/Misleading Error Message when Credentials File is Empty

Open
#7,751 0 comments 1 reaction 0 assignees View on GitHub
library: google-cloud-node-core priority: p2 type: bug
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

#### 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();
```

3. 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.