Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database error when upgrading to 2023.10 from a version older than 2023.8 #7326

Closed
klutchrider opened this issue Oct 26, 2023 · 15 comments
Closed
Labels
question Further information is requested

Comments

@klutchrider
Copy link

Describe your question/
Just updated to 2023.10.1 and since I'm already logged into authentik on a browser, everything is working, but since I tried another browser, I seem to be not getting the login screen, but getting either an iframe or html information as shown below. Not sure what else is needed, but will provide if asked.

Relevant infos

<title> authentik </title> <script type="36da15029b380e93da54aebd-text/javascript"> window.authentik = { locale: "en-us", config: JSON.parse(''), tenant: JSON.parse(''), versionFamily: "", versionSubdomain: "", build: "", }; window.addEventListener("DOMContentLoaded", () => { }); </script> <script src="/static/dist/poly.js?version=2023.10.0" type="36da15029b380e93da54aebd-module"></script> <script src="/static/dist/standalone/loading/index.js?version=2023.10.0" type="36da15029b380e93da54aebd-module"></script> <style> :root { --ak-flow-background: url("/static/dist/assets/images/flow_background.jpg"); --pf-c-background-image--BackgroundImage: var(--ak-flow-background); --pf-c-background-image--BackgroundImage-2x: var(--ak-flow-background); --pf-c-background-image--BackgroundImage--sm: var(--ak-flow-background); --pf-c-background-image--BackgroundImage--sm-2x: var(--ak-flow-background); --pf-c-background-image--BackgroundImage--lg: var(--ak-flow-background); } /* Form with user */ .form-control-static { margin-top: var(--pf-global--spacer--sm); display: flex; align-items: center; justify-content: space-between; } .form-control-static .avatar { display: flex; align-items: center; } .form-control-static img { margin-right: var(--pf-global--spacer--xs); } .form-control-static a { padding-top: var(--pf-global--spacer--xs); padding-bottom: var(--pf-global--spacer--xs); line-height: var(--pf-global--spacer--xl); } </style>
<script src="/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js" data-cf-settings="36da15029b380e93da54aebd-|49" defer></script><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" data-cf-beacon='{"rayId":"81c5bcebafd3e792","r":1,"version":"2023.10.0","token":"2efdb94088f04f08955a32f32a52650a"}' crossorigin="anonymous"></script>

Screenshots
image

Logs
Output of docker-compose logs or kubectl logs respectively

Version and Deployment (please complete the following information):

  • authentik version: [2023.10.1]
  • Deployment: [Unraid]

Additional context
Add any other context about the problem here.

@klutchrider klutchrider added the question Further information is requested label Oct 26, 2023
@klutchrider
Copy link
Author

Screenshot and info is me trying to revert back to 2023.10 with still the same issue.

@raldnor
Copy link

raldnor commented Oct 26, 2023

I've got the same issue. Started with 10.0, cannot roll back to 10.8 unfortunately.

I found this error in the server logs (truncated for readability):

RR | event=Internal Server Error: /api/v3/flows/executor/pass-no-mfa/ exception=[{"exc_type":"ProgrammingError","exc_value":"column authentik_stages_authenticator_static_authenticatorstaticstage.token_length does not exist\nLINE 1: ...r_static_authenticatorstaticstage\".\"token_count\", \"authentik...\n       

Could it be that something went wrong during the database migration process between versions?

@raldnor
Copy link

raldnor commented Oct 27, 2023

I fixed it by adding the missing column in the postgres DB:

alter table authentik_stages_authenticator_static_authenticatorstaticstage add column token_length INTEGER default 12;

@BeryJu
Copy link
Member

BeryJu commented Oct 27, 2023

@klutchrider @raldnor which version did you upgrade from?

@raldnor
Copy link

raldnor commented Oct 27, 2023

I went from 2023.5.0 to 2023.10.0

@BeryJu
Copy link
Member

BeryJu commented Oct 27, 2023

So it seems the error happens when going from a version older than 2023.8 to 2023.10, as a short term solution I'll add a banner to the release notes

@Leptopoda
Copy link

I now face the same issue.
For reference I came from 2023.06

@BeryJu BeryJu changed the title Authentik Login showing HTML Database error when upgrading to 2023.10 from a version older than 2023.8 Oct 27, 2023
@BeryJu BeryJu pinned this issue Oct 27, 2023
@los93sol
Copy link

Any updates on this, facing the same issues

@klutchrider
Copy link
Author

Yeah I came from 2023.4, let me try your fix @raldnor

@klutchrider
Copy link
Author

As stated from @raldnor, connect to your postgres DB, and try adding the table mentioned, should get you back up and running.

Thanks @BeryJu @raldnor

@los93sol
Copy link

los93sol commented Oct 27, 2023

I came from 2023.8 and still had this issue. I ended up manually inserting the migration records into the database, oddly enough, comparing the code in the migrations against my database it appears they actually had been applied properly as all the new fields were there...

insert into django_migrations (app, name, applied) VALUES ('authentik_stages_authenticator_static', '0008_initial', current_timestamp);
insert into django_migrations (app, name, applied) VALUES ('authentik_stages_authenticator_static', '0009_throttling', current_timestamp);
insert into django_migrations (app, name, applied) VALUES ('authentik_stages_authenticator_totp', '0008_initial', current_timestamp);
insert into django_migrations (app, name, applied) VALUES ('authentik_stages_authenticator_totp', '0009_auto_20190420_0723', current_timestamp);

@natoleet
Copy link

I was bitten by the same bug while keeping everything updated with Watchtower using the :latest tag.

@DKingAlpha
Copy link

For anyone who have no prior knowledge about authentik's postgres, the possible online fix is

docker-compose exec -ti -u postgres postgresql psql -U authentik
then in psql shell
alter table authentik_stages_authenticator_static_authenticatorstaticstage add column token_length INTEGER default 12;

@dweee
Copy link

dweee commented Nov 5, 2023

I've tried all the fixes across the issue threads on here, now I'm finally faced with the same login page as OP, Will try joining the discord and asking there. Will report back if anything else works.

EDIT: Never mind, somehow nuked the application settings in authentik I had setup and I'm the only user using the services, so gonna nuke, try again, and make sure I actually do backups in case i have other users later on.

@keesfluitman
Copy link

keesfluitman commented Nov 7, 2023

I came from 2023.8 and still had this issue. I ended up manually inserting the migration records into the database, oddly enough, comparing the code in the migrations against my database it appears they actually had been applied properly as all the new fields were there...

insert into django_migrations (app, name, applied) VALUES ('authentik_stages_authenticator_static', '0008_initial', current_timestamp); insert into django_migrations (app, name, applied) VALUES ('authentik_stages_authenticator_static', '0009_throttling', current_timestamp); insert into django_migrations (app, name, applied) VALUES ('authentik_stages_authenticator_totp', '0008_initial', current_timestamp); insert into django_migrations (app, name, applied) VALUES ('authentik_stages_authenticator_totp', '0009_auto_20190420_0723', current_timestamp);

this actually worked. Thank you so much. How did you know which values to introduce? u just checked which changes were propagated in the updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

9 participants