Hi team, I have self-hosted kratos in my machine. ...
# talk-kratos
f
Hi team, I have self-hosted kratos in my machine. When i tried to access admin api getting following error. But i have default schema defined in it. If someone can help me on this , it'ill be great help
Copy code
curl --location --request GET '<http://127.0.0.1:4434/admin/identities>'
Copy code
{
  "error": {
    "code": 500,
    "status": "Internal Server Error",
    "reason": "The JSON Schema \"<preset://email>\" for this identity's traits could not be found.",
    "message": "An internal server error occurred, please contact the system administrator"
  }
}
w
Check Kratos logs on start. There is chance that the schema could be invalid/corrupted and it would be highlighted in the logs
f
I was able to create identities using sdefault as id key as given in the example. Not sure where it’s looking for schema
w
Schemas and paths to the schemas are set in the Kratos config file
f
Checked the path in
contrib/quickstart/kratos/email-password/kratos.yml
it has the below value. I am not sure where its getting the schema id as preset://email when i request.
Copy code
identity:
  default_schema_id: default
  schemas:
    - id: default
      url: file:///etc/config/kratos/identity.schema.json
and Log I am getting in docker
Copy code
| time=2022-11-30T07:53:49Z level=info msg=started handling request func=<http://github.com/ory/x/reqlog.(*Middleware).ServeHTTP|github.com/ory/x/reqlog.(*Middleware).ServeHTTP> file=/go/pkg/mod/github.com/ory/x@v0.0.392/reqlog/middleware.go:131 http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br connection:keep-alive postman-token:1256f239-5e6b-4987-a2d8-60019fdffe7e user-agent:PostmanRuntime/7.29.2] host:0.0.0.0:4434 method:GET path:/identities query:<nil> remote:172.18.0.1:36036 scheme:http]
kratos_1                      | time=2022-11-30T07:53:49Z level=info msg=completed handling request func=<http://github.com/ory/x/reqlog.(*Middleware).ServeHTTP|github.com/ory/x/reqlog.(*Middleware).ServeHTTP> file=/go/pkg/mod/github.com/ory/x@v0.0.392/reqlog/middleware.go:139 http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br connection:keep-alive postman-token:1256f239-5e6b-4987-a2d8-60019fdffe7e user-agent:PostmanRuntime/7.29.2] host:0.0.0.0:4434 method:GET path:/admin/identities query:<nil> remote:172.18.0.1:36036 scheme:http] http_response=map[headers:map[content-type:text/html; charset=utf-8 location:/admin/identities] size:53 status:307 text_status:Temporary Redirect took:141.902µs]
kratos_1                      | time=2022-11-30T07:53:49Z level=info msg=started handling request func=<http://github.com/ory/x/reqlog.(*Middleware).ServeHTTP|github.com/ory/x/reqlog.(*Middleware).ServeHTTP> file=/go/pkg/mod/github.com/ory/x@v0.0.392/reqlog/middleware.go:131 http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br connection:keep-alive postman-token:1256f239-5e6b-4987-a2d8-60019fdffe7e referer:<http://0.0.0.0:4434/identities> user-agent:PostmanRuntime/7.29.2] host:0.0.0.0:4434 method:GET path:/admin/identities query:<nil> remote:172.18.0.1:36036 scheme:http]
kratos_1                      | time=2022-11-30T07:53:49Z level=error msg=An error occurred while handling a request func=<http://github.com/ory/x/logrusx.(*Logger).ReportError|github.com/ory/x/logrusx.(*Logger).ReportError> file=/go/pkg/mod/github.com/ory/x@v0.0.392/logrusx/logrus.go:228 audience=application error=map[debug: message:An internal server error occurred, please contact the system administrator reason:The JSON Schema "<preset://email>" for this identity's traits could not be found. stack_trace:
kratos_1                      | <http://github.com/ory/kratos/persistence/sql.(*Persister).injectTraitsSchemaURL|github.com/ory/kratos/persistence/sql.(*Persister).injectTraitsSchemaURL>
kratos_1                      | 	/project/persistence/sql/persister_identity.go:562
kratos_1                      | <http://github.com/ory/kratos/persistence/sql.(*Persister).ListIdentities|github.com/ory/kratos/persistence/sql.(*Persister).ListIdentities>
kratos_1                      | 	/project/persistence/sql/persister_identity.go:327
kratos_1                      | <http://github.com/ory/kratos/identity.(*Handler).list|github.com/ory/kratos/identity.(*Handler).list>
kratos_1                      | 	/project/identity/handler.go:122
kratos_1                      | <http://github.com/ory/kratos/x.NoCacheHandle.func1|github.com/ory/kratos/x.NoCacheHandle.func1>
kratos_1                      | 	/project/x/nocache.go:18
kratos_1                      | <http://github.com/julienschmidt/httprouter.(*Router).ServeHTTP|github.com/julienschmidt/httprouter.(*Router).ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/julienschmidt/httprouter@v1.3.0/router.go:387
kratos_1                      | <http://github.com/urfave/negroni.Wrap.func1|github.com/urfave/negroni.Wrap.func1>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46
kratos_1                      | <http://github.com/urfave/negroni.HandlerFunc.ServeHTTP|github.com/urfave/negroni.HandlerFunc.ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29
kratos_1                      | <http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
kratos_1                      | net/http.HandlerFunc.ServeHTTP
kratos_1                      | 	/usr/local/go/src/net/http/server.go:2047
kratos_1                      | <http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1>
kratos_1                      | 	/go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:198
kratos_1                      | net/http.HandlerFunc.ServeHTTP
kratos_1                      | 	/usr/local/go/src/net/http/server.go:2047
kratos_1                      | <http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1>
kratos_1                      | 	/go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:101
kratos_1                      | net/http.HandlerFunc.ServeHTTP
kratos_1                      | 	/usr/local/go/src/net/http/server.go:2047
kratos_1                      | <http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1>
kratos_1                      | 	/go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:68
kratos_1                      | net/http.HandlerFunc.ServeHTTP
kratos_1                      | 	/usr/local/go/src/net/http/server.go:2047
kratos_1                      | <http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2>
kratos_1                      | 	/go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:76
kratos_1                      | net/http.HandlerFunc.ServeHTTP
kratos_1                      | 	/usr/local/go/src/net/http/server.go:2047
kratos_1                      | <http://github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerRequestSize.func1|github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerRequestSize.func1>
kratos_1                      | 	/go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:165
kratos_1                      | net/http.HandlerFunc.ServeHTTP
kratos_1                      | 	/usr/local/go/src/net/http/server.go:2047
kratos_1                      | <http://github.com/ory/x/prometheusx.Metrics.instrumentHandlerStatusBucket.func1|github.com/ory/x/prometheusx.Metrics.instrumentHandlerStatusBucket.func1>
kratos_1                      | 	/go/pkg/mod/github.com/ory/x@v0.0.392/prometheusx/metrics.go:108
kratos_1                      | net/http.HandlerFunc.ServeHTTP
kratos_1                      | 	/usr/local/go/src/net/http/server.go:2047
kratos_1                      | <http://github.com/ory/x/prometheusx.(*MetricsManager).ServeHTTP|github.com/ory/x/prometheusx.(*MetricsManager).ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/ory/x@v0.0.392/prometheusx/middleware.go:30
kratos_1                      | <http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
kratos_1                      | <http://github.com/ory/x/metricsx.(*Service).ServeHTTP|github.com/ory/x/metricsx.(*Service).ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/ory/x@v0.0.392/metricsx/middleware.go:275
kratos_1                      | <http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
kratos_1                      | <http://github.com/ory/kratos/x.HTTPLoaderContextMiddleware.func1|github.com/ory/kratos/x.HTTPLoaderContextMiddleware.func1>
kratos_1                      | 	/project/x/httploadermiddleware.go:20
kratos_1                      | <http://github.com/urfave/negroni.HandlerFunc.ServeHTTP|github.com/urfave/negroni.HandlerFunc.ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29
kratos_1                      | <http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
kratos_1                      | <http://github.com/ory/kratos/x.RedirectAdminMiddleware|github.com/ory/kratos/x.RedirectAdminMiddleware>
kratos_1                      | 	/project/x/http_redirect_admin.go:22
kratos_1                      | <http://github.com/urfave/negroni.HandlerFunc.ServeHTTP|github.com/urfave/negroni.HandlerFunc.ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29
kratos_1                      | <http://github.com/urfave/negroni.middleware.ServeHTTP|github.com/urfave/negroni.middleware.ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38
kratos_1                      | <http://github.com/ory/x/reqlog.(*Middleware).ServeHTTP|github.com/ory/x/reqlog.(*Middleware).ServeHTTP>
kratos_1                      | 	/go/pkg/mod/github.com/ory/x@v0.0.392/reqlog/middleware.go:134 status:Internal Server Error status_code:500] http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br connection:keep-alive postman-token:1256f239-5e6b-4987-a2d8-60019fdffe7e referer:<http://0.0.0.0:4434/identities> user-agent:PostmanRuntime/7.29.2] host:0.0.0.0:4434 method:GET path:/admin/identities query:<nil> remote:172.18.0.1:36036 scheme:http] http_response=map[status_code:500] service_name=Ory Kratos service_version=v0.10.0
kratos_1                      | time=2022-11-30T07:53:49Z level=info msg=completed handling request func=<http://github.com/ory/x/reqlog.(*Middleware).ServeHTTP|github.com/ory/x/reqlog.(*Middleware).ServeHTTP> file=/go/pkg/mod/github.com/ory/x@v0.0.392/reqlog/middleware.go:139 http_request=map[headers:map[accept:*/* accept-encoding:gzip, deflate, br connection:keep-alive postman-token:1256f239-5e6b-4987-a2d8-60019fdffe7e referer:<http://0.0.0.0:4434/identities> user-agent:PostmanRuntime/7.29.2] host:0.0.0.0:4434 method:GET path:/admin/identities query:<nil> remote:172.18.0.1:36036 scheme:http] http_response=map[headers:map[cache-control:private, no-cache, no-store, must-revalidate content-type:application/json] size:236 status:500 text_status:Internal Server Error took:2.261726ms]
This issue got resolved. Thanks