fastify / fastify/fastify-postgres

pg-pool force closing fastify instance

Open
#168 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
216
Forks
38
Avg merge
7d 5h
Merged PRs (30d)
2

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported

### Fastify version

4.x.x

### Plugin version

5.2.2

### Node.js version

18.x

### Operating system

Linux

### Operating system version (i.e. 20.04, 11.3, 10)

22.04

### Description

Hi, I just found out this weird behavior about `pg-pool` and it turned out a known issue on its repo.
When we shutdown/restart PostgreSQL instance, this module will force close our Fastify app! As my understanding, this happens due to lack of error handler in `pg-pool`, resulting unexpected termination event when we wrap the query logic using try catch. Due to my poor explanation, please read this issue: https://github.com/brianc/node-postgres/issues/2439.

### Steps to Reproduce

1. Deploy PostgreSQL
2. Deploy Fastify Instance with PostgreSQL support
3. Shutdown PostgreSQL

### Expected Behavior

_No response_

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.