googleapis / googleapis/google-cloud-node

README client constructor example incorrect (likely out of date).

Open
#7,586 0 comments 0 reactions 0 assignees View on GitHub
api: logging priority: p3 type: bug
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

In the [Using the client library](https://github.com/googleapis/nodejs-logging?tab=readme-ov-file#using-the-client-library) part of the readme, we have the following snippet of code:

```typescript
// Creates a client
const logging = new Logging({projectId});
```

However, I believe this should be changed to:

```typescript
// Creates a client
const logging = new Logging();
logging.setProjectId({projectId});
```

My assumption is that projectId was removed from the constructor in order to allow the client to dynamically connect to several projects; that is during the running of the program it may dynamically switch which project it is connect to.

I am using `"@google-cloud/logging": "^11.2.0"`

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.