Node.js API endpoint for PostgreSQL database backup produces empty SQL file
I have an API endpoint in my Node.js application that should perform a backup of my PostgreSQL database and return the result as an SQL file. The API uses the dockerode library to connect to a PostgreSQL container and run the pg_dump command to create the backup. The API sets the response headers to indicate that the result is a download, and pipes the output from the pg_dump command to the response. However, the resulting SQL file is always empty.
I have logged the output from the pg_dump command and it appears to be running correctly, but the resulting SQL file is always empty. I have tried several different approaches to writing the data to the response, but have had no luck. Can anyone help me figure out why the SQL file
0 Replies