fluent / fluent/fluent-logger-forward-node
Proposal: reject connect() on authentication error
- Dominant language
- TypeScript
- Stars
- 12
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I have a use case where authentication is required:
```js
const logger = new FluentClient("output", {
socket: {
host: "fluentd.local",
port: 24224,
timeout: 3000,
disableReconnect: true,
tls: {
ca: require('fs').readFileSync('./fluentd.crt'),
},
},
security: {
clientHostname: "client.local",
sharedKey: "incorrect",
username: "ooo",
password: "xxx"
},
});
try {
await logger.connect();
} catch (err) {
/* do something with err */
}
```
When security is not correctly configured, `connect()` still resolves.
Though the error could be detected by `logger.socketOn('error')`, it's not synchronous with `connect()` and some mechanism to wait for the error (or to ensure no error thrown) is required.
If `connect()` can reject on error, it would be more easy to determine whether the client is authenticated successfully.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.