denodrivers / denodrivers/postgres

TypeError: Cannot read properties of undefined (reading 'push')

Open
#415 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
655
Forks
97
PR merge metrics
No merged PRs in 30d

Description

I have received the following error many times now (but cannot reproduce it reliably):

```
error: (in promise) TypeError: Cannot read properties of undefined (reading 'push')
() => this.#available_connections!.push(client),
^
at PoolClient. ([redacted]/vendor/deno.land/x/postgres@v0.16.1/pool.ts:191:46)
at PoolClient.release ([redacted]/vendor/deno.land/x/postgres@v0.16.1/client.ts:499:18)
```

pool.ts line 191 reads:
```ts
() => this.#available_connections!.push(client),
```

The exclamation mark is code smell because it suppresses a compiler warning. Without it, deno complains `this.#available_connections` `is possibly 'undefined'`. I think this case should be handled properly.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.