[Help] Django Google OAuth - Works locally but fails in prod with "django_session does not exist"

0xmstorePRO

4 months ago

Hi! I'm having an issue with Google OAuth in my Django app.

Local vs Production behavior:

  • Locally: Google OAuth login works perfectly

  • Production: Getting a "relation 'django_session' does not exist" error

Technical details:

  • Django 5.1.4

  • social-auth-app-django 5.4.0

  • Using PostgreSQL database

  • Error occurs at: /social-auth/login/google-oauth2/

  • Full error: "relation 'djangosession' does not exist LINE 1: SELECT 1 AS 'a' FROM 'djangosession' WHERE 'django_session'…"

It seems the session tables aren't being created in the production database, despite working locally. I suspect this might be related to migrations not being run during deployment, but I'm not sure about the best way to handle this in Railway's environment.

Has anyone encountered this before?

Solved

0 Replies

0xmstorePRO

4 months ago

5176d6ce-2430-490e-a7fe-936dd3567b94


0xmstorePRO

4 months ago

this is exactly what i see when i try login with google auth in prod

1327573687506829300



4 months ago

You can run your migration script in your start command



4 months ago

you can now run the migration command in the pre-deploy command!


4 months ago

Marking this as solved as migrations are the likely cause


4 months ago

!s


Status changed to Solved adam 4 months ago