<@U04UQ68083H> updating to kratos v1.2 I get the f...
# ory-copilot
p
@chilly-king-10285 updating to kratos v1.2 I get the following error in the kratos logs even though the kratos-init container says no migrations needed.
Copy code
{"http_request":{"headers":{"accept":"*/*","connection":"close","user-agent":"kube-probe/1.27"},"host":"127.0.0.1","method":"GET","path":"/admin/health/ready","query":null,"remote":"10.244.0.1:34620","scheme":"http"},"level":"info","msg":"started handling request","time":"2024-06-18T15:58:51.787394253Z"}
{"audience":"application","error":{"message":"migrations have not yet been fully applied","stack_trace":"stack trace could not be recovered from error type *healthx.swaggerNotReadyStatus"},"http_request":{"headers":{"accept":"*/*","connection":"close","user-agent":"kube-probe/1.27"},"host":"127.0.0.1","method":"GET","path":"/admin/health/ready","query":null,"remote":"10.244.0.1:34620","scheme":"http"},"http_response":{"status_code":503},"level":"error","msg":"An error occurred while handling a request","service_name":"Ory Kratos","service_version":"v1.2.0","time":"2024-06-18T15:58:51.78992481Z"}
{"http_request":{"headers":{"accept":"*/*","connection":"close","user-agent":"kube-probe/1.27"},"host":"127.0.0.1","method":"GET","path":"/admin/health/ready","query":null,"remote":"10.244.0.1:34620","scheme":"http"},"http_response":{"headers":{"cache-control":"private, no-cache, no-store, must-revalidate","content-type":"application/json"},"size":111,"status":503,"text_status":"Service Unavailable","took":2639805},"level":"info","msg":"completed handling request","time":"2024-06-18T15:58:51.790009652Z"}
{"audience":"application","level":"info","msg":"Public httpd was shutdown gracefully","service_name":"Ory Kratos","service_version":"v1.2.0","time":"2024-06-18T15:58:51.802776695Z"}
{"audience":"application","level":"info","msg":"Admin httpd was shutdown gracefully","service_name":"Ory Kratos","service_version":"v1.2.0","time":"2024-06-18T15:58:51.802807183Z"}
c
A message from kapa.ai
The error message you're seeing indicates that there are still some database migrations that need to be applied. Even though the
kratos-init
container says no migrations are needed, the main Kratos service is reporting otherwise. When upgrading Ory Kratos to a newer version, it's important to run the SQL migrations to update the database schema. This can be done using the
kratos migrate sql
command as mentioned in the [upgrade guide](https://www.ory.sh/docs/kratos/guides/upgrade). If you've already done this and are still seeing the error, it's possible that there might be an issue with the specific version you're upgrading to. You should review the [CHANGELOG.md](https://github.com/ory/kratos/blob/master/CHANGELOG.md) to see if any breaking changes have been introduced in the version you're upgrading to. If you continue to encounter issues, consider reaching out to the Ory community via their [chat](https://slack.ory.sh/) or starting a [discussion](https://github.com/ory/kratos/discussions) on their GitHub page.
p
@chilly-king-10285 this is what the init container says (the init container runs
kratos sql migrate ...
):
Copy code
{"audience":"application","level":"debug","msg":"Migrations already up to date, nothing to apply","service_name":"Ory Kratos","service_version":"v1.1.0","time":"2024-06-18T15:55:49.560009741Z"}
{"audience":"application","level":"debug","msg":"0.0536 seconds","service_name":"Ory Kratos","service_version":"v1.1.0","time":"2024-06-18T15:55:49.560019209Z"}
Successfully applied SQL migrations!
c
A message from kapa.ai
The logs from the init container indicate that the migrations are up to date and there's nothing to apply. However, the error message from the Kratos service suggests otherwise. This discrepancy could be due to a number of reasons. One possibility is that the Kratos service and the init container are not using the same database or are somehow out of sync. Ensure that both are configured to use the same database and that the database is accessible. Another possibility is that there's a bug in the version of Kratos you're using. You mentioned that the service version is
v1.2.0
but the init container is running
v1.1.0
. It's recommended to use the same version for both the service and the init container to avoid potential compatibility issues. If you're still encountering issues, it would be best to reach out to the Ory community for further assistance. You can do this via their [chat](https://slack.ory.sh/) or by starting a [discussion](https://github.com/ory/kratos/discussions) on their GitHub page.
p
@chilly-king-10285 I got it: I only upgraded the kratos container image not the init-container.
c
A message from kapa.ai
I'm glad you found the issue! Yes, when upgrading Ory Kratos, it's important to upgrade both the main Kratos service and the init container to the same version. This ensures that they're both using the same database schema and can prevent issues like the one you encountered. To upgrade the init container, you would need to update the version in your Dockerfile or docker-compose file (or however you're specifying your container images) to match the version of the main Kratos service. Here's an example of how you might specify the version in a Dockerfile:
Copy code
dockerfile FROM oryd/kratos:{version}
And here's an example of how you might specify it in a docker-compose file:
Copy code
yaml services:   kratos:     image: oryd/kratos:{version}   kratos-init:     image: oryd/kratos:{version}
Just replace
{version}
with the version number you're upgrading to. Remember to run the migrations again after upgrading the init container. This can be done using the
kratos migrate sql
command.