Reaction Commerce Forums

Hydra/login error

Everything is working for me when I clone and make from and ec2 instance in dev mode, except login functionality. I get a ‘could not connect’ or ‘connection timed out’ error. Has anyone else run into this?

Looking at my reaction-hydra logs, hydra-migrate is failing its first build step of connecting to SQL @ 172.21.0.2:5432. Here are my logs:

Attaching to reaction-hydra_hydra_1, reaction-hydra_hydra-migrate_1, reaction-hydra_postgres_1
hydra_1 | time=“2019-10-05T05:56:49Z” level=info msg=“Connecting with postgres://:@postgres:5432/hydra?sslmode=disable”
hydra-migrate_1 | time=“2019-10-05T05:56:47Z” level=error msg=“An error occurred” error=“Could not connect to SQL: dial tcp 172.21.0.2:5432: connect: connection refused”
hydra_1 | Thank you for using ORY Hydra v1.0.0-beta.9!
postgres_1 | The files belonging to this database system will be owned by user “postgres”.
hydra-migrate_1 | time=“2019-10-05T05:56:47Z” level=info msg=“Retrying in 0.100000 seconds…”
hydra_1 |
postgres_1 | This user must also own the server process.
hydra-migrate_1 | time=“2019-10-05T05:56:48Z” level=error msg=“An error occurred” error=“Could not connect to SQL: dial tcp 172.21.0.2:5432: connect: connection refused”
hydra_1 | Take security seriously and subscribe to the ORY Security Newsletter. Stay on top of new patches and security insights.
postgres_1 |
hydra-migrate_1 | time=“2019-10-05T05:56:48Z” level=info msg=“Retrying in 0.200000 seconds…”
hydra_1 |
postgres_1 | The database cluster will be initialized with locale “en_US.utf8”.
hydra-migrate_1 | time=“2019-10-05T05:56:48Z” level=error msg=“An error occurred” error=“Could not connect to SQL: dial tcp 172.21.0.2:5432: connect: connection refused”
hydra_1 | >> Subscribe now: http://eepurl.com/di390P <<
postgres_1 | The default database encoding has accordingly been set to “UTF8”.
hydra-migrate_1 | time=“2019-10-05T05:56:48Z” level=info msg=“Retrying in 0.400000 seconds…”
hydra_1 | time=“2019-10-05T05:56:49Z” level=info msg=“Connected to SQL!”
postgres_1 | The default text search configuration will be set to “english”.
hydra-migrate_1 | time=“2019-10-05T05:56:48Z” level=error msg=“An error occurred” error=“Could not connect to SQL: dial tcp 172.21.0.2:5432: connect: connection refused”
hydra_1 | time=“2019-10-05T05:56:49Z” level=fatal msg=“Could not fetch private signing key for OpenID Connect - did you forget to run “hydra migrate sql” or forget to set the SYSTEM_SECRET?” error=“pq: relation “hydra_jwk” does not exist”
postgres_1 |
hydra-migrate_1 | time=“2019-10-05T05:56:48Z” level=info msg=“Retrying in 0.800000 seconds…”
hydra_1 | Thank you for using ORY Hydra v1.0.0-beta.9!
postgres_1 | Data page checksums are disabled.
hydra-migrate_1 | Applying consent SQL migrations…
hydra_1 |
postgres_1 |
hydra-migrate_1 | Applied 3 consent SQL migrations.
postgres_1 | fixing permissions on existing directory /var/lib/postgresql/data … ok
hydra_1 | Take security seriously and subscribe to the ORY Security Newsletter. Stay on top of new patches and security insights.
hydra-migrate_1 | Applying client SQL migrations…
postgres_1 | creating subdirectories … ok
hydra_1 |
postgres_1 | selecting default max_connections … 100
hydra-migrate_1 | Applied 8 client SQL migrations.
hydra_1 | >> Subscribe now: http://eepurl.com/di390P <<
hydra-migrate_1 | Applying oauth2 SQL migrations…
postgres_1 | selecting default shared_buffers … 128MB
hydra_1 | time=“2019-10-05T05:56:51Z” level=info msg=“Connecting with postgres://:@postgres:5432/hydra?sslmode=disable”
hydra-migrate_1 | Applied 4 oauth2 SQL migrations.
postgres_1 | selecting dynamic shared memory implementation … posix
hydra_1 | time=“2019-10-05T05:56:51Z” level=info msg=“Connected to SQL!”
hydra-migrate_1 | Applying jwk SQL migrations…
postgres_1 | creating configuration files … ok
hydra_1 | time=“2019-10-05T05:56:51Z” level=info msg=“JSON Web Key Set hydra.openid.id-token does not exist yet, generating new key pair…”
postgres_1 | running bootstrap script … ok
hydra-migrate_1 | Applied 3 jwk SQL migrations.
hydra_1 | time=“2019-10-05T05:56:53Z” level=info msg=“Setting up Prometheus middleware”
postgres_1 | performing post-bootstrap initialization … ok
hydra-migrate_1 | Migration successful! Applied a total of 18 SQL migrations.
hydra_1 | time=“2019-10-05T05:56:53Z” level=info msg=“Transmission of telemetry data is enabled, to learn more go to: https://www.ory.sh/docs/guides/latest/telemetry/
postgres_1 |
hydra-migrate_1 | Migration successful!
postgres_1 | WARNING: enabling “trust” authentication for local connections
hydra_1 | time=“2019-10-05T05:56:53Z” level=info msg=“Detected local environment, skipping telemetry commit”
postgres_1 | You can change this by editing pg_hba.conf or using the option -A, or
hydra_1 | time=“2019-10-05T05:56:53Z” level=info msg=“Detected local environment, skipping telemetry commit”
hydra_1 | time=“2019-10-05T05:56:53Z” level=info msg=“JSON Web Key Set hydra.https-tls does not exist yet, generating new key pair…”
postgres_1 | --auth-local and --auth-host, the next time you run initdb.
hydra_1 | time=“2019-10-05T05:56:55Z” level=info msg=“Setting up http server on :4445”
postgres_1 | syncing data to disk … ok
hydra_1 | time=“2019-10-05T05:56:55Z” level=warning msg=“HTTPS disabled. Never do this in production.”
postgres_1 |
hydra_1 | time=“2019-10-05T05:56:55Z” level=info msg=“Setting up http server on :4444”
postgres_1 | Success. You can now start the database server using:
hydra_1 | time=“2019-10-05T05:56:55Z” level=warning msg=“HTTPS disabled. Never do this in production.”
postgres_1 |
hydra_1 | time=“2019-10-05T06:01:22Z” level=info msg=“started handling request” method=POST remote=“172.18.0.4:50274” request=/clients
postgres_1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1 |
hydra_1 | time=“2019-10-05T06:01:22Z” level=info msg=“completed handling request” measure#http://localhost:4444.latency=95188941 method=POST remote=“172.18.0.4:50274” request=/clients status=201 text_status=Created took=95.188941ms
postgres_1 | waiting for server to start…2019-10-05 05:56:48.466 UTC [39] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
postgres_1 | 2019-10-05 05:56:48.483 UTC [40] LOG: database system was shut down at 2019-10-05 05:56:48 UTC
postgres_1 | 2019-10-05 05:56:48.490 UTC [39] LOG: database system is ready to accept connections
postgres_1 | done
postgres_1 | server started
postgres_1 | CREATE DATABASE
postgres_1 |
postgres_1 | CREATE ROLE
postgres_1 |
postgres_1 |
postgres_1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres_1 |
postgres_1 | 2019-10-05 05:56:48.937 UTC [39] LOG: received fast shutdown request
postgres_1 | waiting for server to shut down…2019-10-05 05:56:48.939 UTC [39] LOG: aborting any active transactions
postgres_1 | 2019-10-05 05:56:48.941 UTC [39] LOG: worker process: logical replication launcher (PID 46) exited with exit code 1
postgres_1 | 2019-10-05 05:56:48.942 UTC [41] LOG: shutting down
postgres_1 | 2019-10-05 05:56:48.958 UTC [39] LOG: database system is shut down
postgres_1 | done
postgres_1 | server stopped
postgres_1 |
postgres_1 | PostgreSQL init process complete; ready for start up.
postgres_1 |
postgres_1 | 2019-10-05 05:56:49.050 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432
postgres_1 | 2019-10-05 05:56:49.050 UTC [1] LOG: listening on IPv6 address “::”, port 5432
postgres_1 | 2019-10-05 05:56:49.053 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
postgres_1 | 2019-10-05 05:56:49.116 UTC [66] LOG: database system was shut down at 2019-10-05 05:56:48 UTC
postgres_1 | 2019-10-05 05:56:49.122 UTC [1] LOG: database system is ready to accept connections
postgres_1 | 2019-10-05 05:56:49.606 UTC [74] ERROR: relation “hydra_jwk” does not exist at character 15
postgres_1 | 2019-10-05 05:56:49.606 UTC [74] STATEMENT: SELECT * FROM hydra_jwk WHERE sid=$1 ORDER BY created_at DESC

Actually, that error was because I didn’t have python3-migrate installed. I solved it by running: sudo apt install python3-migrate on my ec2 instance.

Now, I’m getting a response of: The server at ec2-ip.compute.amazonaws.com is taking too long to respond.

welp, looks like I hadn’t set a rule to allow traffic to port 4444, so that’s my problem.