mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:53:00 +03:00
🐛 Bug Report: Failed upgrade to 1.8.0 #70
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @stanrc85 on GitHub.
Reproduction steps
I just updated to 1.8 and my docker container shows the following error repeatedly and won't start
Expected behavior
Upgrade and start as normal
Actual Behavior
Error loop
Version and Environment
1.8 docker container
Log Output
No response
@Taywee commented on GitHub:
Saame here, also postgres. My dirty database version shows as
20250814121300, though.Also, I can't seem to drop back to v1.7.0, either. I get the same error on that version now.
@Ulrar commented on GitHub:
Same here with the default sqlite, and unfortunately rolling back does not fix it.
@rjvdw commented on GitHub:
Facing the same issue, using postgres. The error that caused the failed migration seems to be:
@lhw commented on GitHub:
To fallback to 1.7 pin the tag in the compose file and run this on your database
That brought mine back into a working state until the 1.8 is fixed.
@sblvkr commented on GitHub:
Facing a similar issue after upgrading to 1.8 using Postgres. The migration process fails with a foreign key constraint error, preventing the database from initializing properly
@Ulrar commented on GitHub:
Sure, here it is :
Same as the OP
@Ulrar commented on GitHub:
How would that work for sqlite ?
@ItalyPaleAle commented on GitHub:
I think I found the cause, and should be fixed by #869 Seems to be a Postgres-specific error
@Ulrar commented on GitHub:
It's definitely not pg specific
@ItalyPaleAle commented on GitHub:
Can you please share logs with SQLite? I cannot repro
@Ulrar commented on GitHub:
Unfortunately not, it's running in k8s so it crashed and got retried pretty much right away, I never saw anything else but it might just be because the container had already been restarted a bunch of times by the time I looked.
@ItalyPaleAle commented on GitHub:
@Ulrar sadly these logs just show that the database is in a dirty version. If you have a backup of the database on version 1.7.x, can you please try rolling back, and then upgrade to 1.8.0? What we need are the logs showing exactly what query failed, such as here: https://github.com/pocket-id/pocket-id/issues/866#issuecomment-3217240168
@ItalyPaleAle commented on GitHub:
@halictuz Please see here: https://github.com/pocket-id/pocket-id/issues/866#issuecomment-3217887941 If you can provide the logs it would be very helpful
@ItalyPaleAle commented on GitHub:
@Ulrar can i ask for your help trying to roll back the migrations manually, then perform an upgrade, and try to capture the logs?
I am not able to repro this with SQLite in any way :(
To perform a manual rollback:
This should be enough to bring back the database to the 1.7.0 .... should, because there were some other queries that altered the data (and which caused #865 too), that can't be rolled back without a backup
@halictuz commented on GitHub:
Same issue for me. With sqlite.
@tilwegener commented on GitHub:
I’m experiencing the same issue.
My setup: Postgres 16.10 and using the distroless image of pocketid.
@Metzlmane commented on GitHub:
This hit me hard, exactly the same issue for me.
Thanks! https://github.com/pocket-id/pocket-id/issues/866#issuecomment-3217345784
that fixed it for now
@yuri-becker commented on GitHub:
I also have the issue. My Postgres version is 16.10 and I use the distroless image of pocketid.
@oechsler commented on GitHub:
Hi there 👋
When using PostgreSQL, it seems the issue is caused by a type mismatch in the migration’s CREATE TABLE statement:
20250814121300_requires_reauthentication.up.sql
TLDR: Switching
reauthentication_tokens.user_idtoUUIDresolved the issue for me ✅On PostgreSQL this fails because
users.idisUUID, butreauthentication_tokens.user_idwas created asTEXT. FK columns must match the referenced type;TEXT↔UUIDisn’t implicitly castable. Changinguser_idtoUUIDfixes it.Not sure if this is still relevant or already fixed, but I figured I’d share in case it helps someone.
@halictuz commented on GitHub:
I already rolled back to a snapshot of my server before the update to v.1.8.0. I didnt watch any further but the docker log only. Thats why I rolled back instantly, I didnt have much time for it. So I am on v1.7.0 again.
Only other info I have is, that I run the distroless version of Pocket-id. Not sure if that even matters.
@Ulrar commented on GitHub:
Unfortunately the container image does not seem to ship with the sqlite binary, so it's pretty hard to recover from this. I'm looking for a workaround.
@ItalyPaleAle commented on GitHub:
@Ulrar ok I may have an idea.
Since I still cannot repro this, could I ask you for one last favor please?
Can you add this env var to your podspec and try upgrading to 1.8.0 again?
If you could help with confirming this fixes the issue, I can bake it directly into the container
@Ulrar commented on GitHub:
Sure, here's the pod :
And the config :
@ItalyPaleAle commented on GitHub:
@Ulrar thanks, this is very helpful
You mention you're using the distroless container, could you share your container's config? (Docker Compose, K8s pod, etc)
@Ulrar commented on GitHub:
Hi @ItalyPaleAle ,
I've found a random static binary of sqlite on github, hopefully it was legitimate.
Here's the output after running your queries, then running 1.8 again :
Good news is I was able to rollback to 1.7 after running these queries again, so at least I'm back up. thanks
@stanrc85 commented on GitHub:
So does the fix need to be done manually or will a new patch correct everything automatically?
@Ulrar commented on GitHub:
Yep, that did the trick, all good on 1.8.1 with that env var defined.
Thank you very much !
@johnnycube commented on GitHub:
I am running on Postgres, upgrading from 1.7.0 to 1.8.0 fails with the error above.
However I can confirm that upgrading from 1.7.0 to 1.8.1 works without error and without the need to use the above mentioned workaround
@Taywee commented on GitHub:
I can confirm that after running remediation in this comment (I know it's for SQLite, but I figured it wouldn't hurt on Postgres) and upgrading to v1.8.1, everything seems to work fine for me! Thank you.
From now on, I will always make a database backup before upgrades. I probably should have been doing that anyway. 😅
@ItalyPaleAle commented on GitHub:
Great, thanks for confirming!! I'll have a PR to fix this issue hopefully for good
@poudenes commented on GitHub:
I have this same issue with Postgres dB... how can I solve this?
@Collectathon commented on GitHub:
Thank you so much for posting this anyway. This helped me recover my database.
@poudenes commented on GitHub:
With some help of ChatGPT fixed it myself:
There was one record. Changed TRUE to FALSE