Error on Database Migrate

I am trying to connect a Rails application on Render with a Postgres db also on Render.

When I try to run the migrations during my application build I get the following error: ‘PG::ConnectionBad: SSL connection has been closed unexpectedly’.

I am using the database url generated by Render for use with applications hosted on Render. I have a YAML set up linking my application with the database.

Not sure what’s going wrong I have tried with values of pool in my config.yml at 1, 2 and 5.

I would truly appreciate any help!

Similar issue to earlier topic but a different error!

1 Like

I’m having similar problems with Elixir/Ecto:

17:44:26.599 [error] GenServer #PID<0.257.0> terminating
** (DBConnection.ConnectionError) ssl recv: closed
    (db_connection 2.3.1) lib/db_connection/connection.ex:100: DBConnection.Connection.connect/2
    (connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol

Is part of running the migrations dropping of the database? When I try to delete the database the connection is closed.

Hi,

Do you run into this issue only when you run migrations or in other scenarios as well ?

I saw the same thing with SQLPro (macOS Postgres application) when I tried to drop the database.

I’m having the same issue with $ dropdb

$ PGPASSWORD=[hidden] dropdb -h oregon-postgres.render.com -U app app_odks

dropdb: error: could not connect to database template1: SSL connection has been closed unexpectedly

As far as I can tell, there isn’t a way to drop a database, which is probably by design, but it will prevent most migration scripts from executing.

Hello @john,

You are correct that there is no way to drop the database. There is a feature request for the ability to clear out/reset a database Add an easy way to clear PostgreSQL data | Feature Requests | Render you could upvote that feature and add a comment about your use case; you’ll then get notified of status changes, such as the feature moving to in progress.

Could you share more details about your migration tool and what you’re trying to do? In our experience most users are able to use the databases effectively without the ability to drop databases and maybe we can find a workaround for your case?

Thanks for your reply. I think that’s fine. I’ll vote for the clear db feature request, but you’re right, the ability to drop db isn’t crucial and can be worked around.

I’m not using a migration tool per se. I’m just using psql generated from dumpdb that assumes that a database doesn’t exist.