ent icon indicating copy to clipboard operation
ent copied to clipboard

tsent codegen requires database with username exists

Open rvlasveld opened this issue 2 years ago • 1 comments

It seems that when running tsent codegen, it requires that a database with the same username exists. If that DB doesn't exist (and a different DB name is used), it fails to connect.

After creating an empty db with the same username, the codegen step succeeds on the correct (non-username) database.

Hypo: somewhere the database name isn't passed through correctly and we connect without it, making postgresql default to the username as db name?

Repro's with both config/database.yml and DB_CONNECTION_STRING method:

DB_CONNECTION_STRING=postgres://john:@localhost/foobar tsent codegen

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
checking for custom graphql definitions...
Error:
  auto_schema error: (psycopg2.OperationalError) connection to server at "localhost" (::1), port 5432 failed: FATAL:  database "john" does not exist

(Background on this error at: https://sqlalche.me/e/14/e3q8)
...

rvlasveld avatar Jan 04 '23 13:01 rvlasveld

just randomly stumbled onto this one.

do you have an (undocumented) ent.yml file with schemaSQLFilePath

I repro this with todo-sqlite and simple examples which is expected but not with ent-rsvp/backend example.

lolopinto avatar May 29 '23 22:05 lolopinto