postgres: server closed the connection unexpectedly

I am trying to import some geospatial data via ogr2ogr from my fly app to an attached postgres cluster. It is using the normal DATABASE_URL.

0...10...20...30...40...50...60...70...ERROR 1: server closed the connection unexpectedly

This probably means the server terminated abnormally before or while processing the request.

The query looks like this:

  PGCLIENTENCODING=UTF8 ogr2ogr \
    -progress \
    -f Postgresql \
    -s_srs EPSG:4326 \
    -t_srs EPSG:3857 \
    -clipsrc -180.1 -85.0511 180.1 85.0511 \
    "PG:${DATABASE_URL%\?*}" \
    -lco GEOMETRY_NAME=geometry \
    -lco OVERWRITE=YES \
    -lco DIM=2 \
    -nlt GEOMETRY \
    -overwrite \
    "${NATURAL_EARTH_FILE:?}"

And the import is less than 1 GB.

Does the fly postgres cluster not allow for long running queries? Can this be tuned through the postgres config?

Any help would be appreciated.

SSHing into the postgres app and running the queries against locahost:5432 imports successfully. So it is definitely an issue with long running queries between the postgres app and the application server. Perhaps limits set in HAproxy?