"Run an Elixir Phoenix app in the App Engine flexible environment" tutorial error

I have followed the “Run an Elixir Phoenix app in the App Engine flexible environment” tutorial (https://cloud.google.com/community/tutorials/elixir-phoenix-on-google-app-engine) twice now. I get the same errors:

# command
$ gcloud app logs tail -s default


2019-10-07 14:27:06 default[20191007t230954]  "GET /" 502
2019-10-07 14:27:07 default[20191007t230954]  2019/10/07 14:27:07 New connection for "hello-255110:us-central1:hellodb"
2019-10-07 14:27:08 default[20191007t230954]  2019/10/07 14:27:08 New connection for "hello-255110:us-central1:hellodb"
2019-10-07 14:27:08 default[20191007t230954]  2019/10/07 14:27:08 New connection for "hello-255110:us-central1:hellodb"
2019-10-07 14:27:08 default[20191007t230954]  2019/10/07 14:27:08 New connection for "hello-255110:us-central1:hellodb"
2019-10-07 14:27:12 default[20191007t230954]  2019/10/07 14:27:12 New connection for "hello-255110:us-central1:hellodb"
2019-10-07 14:27:12 default[20191007t230954]  14:27:12.827 [error] Postgrex.Protocol (#PID<0.1386.0>) failed to connect: ** (Postgrex.Error) FATAL 53300 (too_many_connections) remaining connection slots are reserved for non-replication superuser connections
2019-10-07 14:27:12 default[20191007t230954]  2019/10/07 14:27:12 Instance hello-255110:us-central1:hellodb closed connection
2019-10-07 14:27:26 default[20191007t230954]  2019/10/07 14:27:26 New connection for "hello-255110:us-central1:hellodb"
2019-10-07 14:27:26 default[20191007t230954]  14:27:26.159 [error] Postgrex.Protocol (#PID<0.1386.0>) failed to connect: ** (Postgrex.Error) FATAL 53300 (too_many_connections) remaining connection slots are reserved for non-replication superuser connections
2019-10-07 14:27:26 default[20191007t230954]  2019/10/07 14:27:26 Instance hello-255110:us-central1:hellodb closed connection
2019-10-07 14:27:52 default[20191007t230954]  2019/10/07 14:27:52 New connection for "hello-255110:us-central1:hellodb"
2019-10-07 14:27:52 default[20191007t230954]  14:27:52.282 [error] Postgrex.Protocol (#PID<0.1386.0>) failed to connect: ** (Postgrex.Error) FATAL 53300 (too_many_connections) remaining connection slots are reserved for non-replication superuser connections
2019-10-07 14:27:52 default[20191007t230954]  2019/10/07 14:27:52 Instance hello-255110:us-central1:hellodb closed connection

In the UI I get “502 Bad Gateway” the nginx error.

Can anyone look at the tutorial and tell me if there are any glaring omissions/errors in it? I am new to Elixir and have been trying to get an app deployed to a PaaS other than Heroku for longer than I’d like to admit.

To debug the too many connections I brought them down to 1 pool_size: 1. Then I discovered i had to add server: true to prod.secret.exs

1 Like