Error "relation "sessions" does not exist" during auth token refresh

  • We're using Supabase auth
  • Our users get logged out an hour after logging in, during token refresh
  • The logging out happens because of token revocation due to the error "relation 'sessions' does not exist". sessions is a table in the auth schema.
  • we have a custom_access_token auth hook set up. The hook is in the public schema and uses the definer tag
  • logs show the custom_access_token hook runs successfully upon token refresh. But token refresh fails with the error shown in the below log
  • Edit: The 'sessions' table is in the auth schema, but the supabase_auth_admin isn't able to access it
Log event metadata
[ { "file": null, "host": "db-ynxjrpyghkowsvdunxda", "metadata": [], "parsed": [ { "application_name": null, "backend_type": "client backend", "command_tag": "PARSE", "connection_from": "127.0.0.1:60983", "context": null, "database_name": "postgres", "detail": null, "error_severity": "ERROR", "hint": null, "internal_query": null, "internal_query_pos": null, "leader_pid": null, "location": null, "process_id": 692664, "query": "UPDATE \"sessions\" AS sessions SET \"ip\" = $1, \"refreshed_at\" = $2, \"updated_at\" = $3, \"user_agent\" = $4 WHERE sessions.id = $5", "query_id": 0, "query_pos": 8, "session_id": "67915fb4.a91b8", "session_line_num": 13, "session_start_time": "2025-01-22 21:14:28 UTC", "sql_state_code": "42P01", "timestamp": "2025-01-22 21:14:28.671 UTC", "transaction_id": 133169, "user_name": "supabase_auth_admin", "virtual_transaction_id": "8/653992" } ], "parsed_from": null, "project": null, "source_type": null } ]

Any troubleshooting tips?
Was this page helpful?