boxyhq / saas-starter-kit

🔥 Enterprise SaaS Starter Kit - Kickstart your enterprise app development with the Next.js SaaS boilerplate 🚀
https://boxyhq.com/blog/enterprise-ready-saas-starter-kit
Apache License 2.0
3.39k stars 765 forks source link

table jackson_ttl missing with default configuration #1572

Open shuther opened 3 months ago

shuther commented 3 months ago

Just starting the template,

in .env I have:

DATABASE_URL=postgresql....
# default value for AUTH_PROVIDERS, not sure how the app behaves in this situation
AUTH_PROVIDERS=

npx prisma db push did not return any error.

I am able to signup an account, but when I click on Settings/Single Sign-On, I have the error below:

query failed: SELECT "table_schema", "table_name", obj_description(('"' || "table_schema" || '"."' || "table_name" || '"')::regclass, 'pg_class') AS table_comment FROM "information_schema"."tables" WHERE ("table_schema" = 'public' AND "table_name" = 'jackson_store') OR ("table_schema" = 'public' AND "table_name" = 'jackson_index') OR ("table_schema" = 'public' AND "table_name" = 'jackson_ttl')
error: error: relation "public.jackson_ttl" does not exist
Recording is off, propagating context in a non-recording span
error connecting to engine: sql, type: postgres db: QueryFailedError: relation "public.jackson_ttl" does not exist

I would have expected the tables to be setup.

niwsa commented 3 months ago

@shuther What version of postgres are you running ?

shuther commented 2 months ago

I used the managed service offer (free for now) from https://xata.io/; my guess is that something was missing during the migration. happy to start again from a fresh start if I can help you to debug it?

niwsa commented 2 months ago

How did you run the migration ?

shuther commented 2 months ago

I found the problem, the error message was misleading (the table exists); and I am not sure if the problem is on the xata side, prisma or somewhere else. pg_catalog.obj_description is expected an OID as per postgres16 doc , but it is called using ('"' || "table_schema" || '"."' || "table_name" || '"') and it seems to work ok. However the cast (:regclass) is not accepted when it is called in a particular way. I tested it with cast(xxx as regclass) but not sucess neither.

pg_catalog.obj_description('public.jackson_ttl'::regclass, 'pg_class') is working. pg_catalog.obj_description('"public"."jackson_ttl"'::regclass, 'pg_class') is also working ('"' || "table_schema" || '"."' || "table_name" || '"')::regclass as c is NOT working

I will open a bug with xata as it sounds an issue with their postgresql server.