Hi Folks!! :wave: We are using ory kratos self hos...
# talk-kratos
b
Hi Folks!! 👋 We are using ory kratos self hosted instance and postgresql database to store identities
Issue :
On login
Copy code
{
  "code": 500,
  "status": "Internal Server Error",
  "message": "ERROR: column \"oauth2_login_challenge\" of relation \"selfservice_login_flows\" does not exist (SQLSTATE 42703)"
}
We are facing above issue when providing DSN as below in my quickstart.yml file
Copy code
environment:
      - DSN=<postgres://database-server-credentials:5432/dev-ory>
      - LOG_LEVEL=trace
Note
: DSN= memory --> works fine
c
Did you run the db migrations?
b
Hi @curved-fountain-46946, I am not aware with migration run. Is there any command or doc available ?
c
Yeah, there are some ways to do it, here are the manual steps: https://www.ory.sh/docs/kratos/cli/kratos-migrate-sql . I think there are some ways to make your kratos instance do this on boot too, but I am not familiar enough with the mechanic to tell you exactly how all of those work. For docker-compose, there is an example yaml here: https://github.com/ory/kratos/blob/master/quickstart.yml . I know there are some helm charts too somewhere, and maybe even some flags if you're running it straight on the iron (?)
b
Oh Great, Thanks!!
Hi @curved-fountain-46946, While checking initial logs i got this, although connection URL is already defined 🤔
Copy code
level=debug msg=No SQL connection options have been defined, falling back to default connection options. func=<http://github.com/ory/x/logrusx.(*Logger).Logf|github.com/ory/x/logrusx.(*Logger).Logf> file=/go/pkg/mod/github.com/ory/x@v0.0.392/logrusx/helper.go:118 audience=application service_name=Ory Kratos service_version=v0.10.1 sql_max_connection_lifetime=0s sql_max_connections=16 sql_max_idle_connection_time=0s sql_max_idle_connections=8
Sharing quickstart file, please let me know if you get anything wrong
s
The connection seems fine, as it knows the table
You have to make sure the migrations are being run
Your
kratos-migrate
container needs a command
b
Okay @steep-lamp-91158 Thanks!, I think issue is related to postgres or configuration because same dsn is not working in my colleagues machine 👀
When they are using DSN as our rds (aws) server db instead of memory they are getting auth/error with below payload
Copy code
{
  "code": 500,
  "status": "Internal Server Error",
  "message": "ERROR: column \"oauth2_login_challenge\" of relation \"selfservice_login_flows\" does not exist (SQLSTATE 42703)"
}
s
on memory migrations are always applied
can you run
kratos migrate sql
against your db and verify all are applied?
this is 💯% the issue
b
Right!!, Let me check 🪄
s
obviously same version as the server
b
Okay
s
what did you get?
b
Hey @steep-lamp-91158, Thanks a lot man. it has worked 🎉