QuestionHi team! I have a working pure Supabase Auth next.js app. Parts of files: And register / login forms where I'm using Next, I'm trying to integrate Prisma using the official tutorial https://supabase.com/partners/integrations/prisma Using Supabase Auth with Prisma. My And then I'm running prisma migration: If I choose Yesterday I was digging a lot with it and found this article https://medium.com/@warren_74490/making-prisma-and-supabase-play-nicely-5acfe2255591 so I tried this approach with Looking forward to fixing these issues, thanks! How to reproduce (optional)Expected behavior (optional)No response Information about Prisma Schema, Client Queries and Environment (optional)// Add your schema.prisma// Add any relevant Prisma Client queries here
|
Replies: 3 comments 3 replies
|
Hi @lorekadam 👋 Thank you for raising this question. Can you please share the auth error message you are getting? If your repository is open source, please share it so we can try to reproduce it. Additionally, we found this GitHub issue that seems related to the issue you are running into. Can you try this out and see if it fixes your issue? |
|
I found a solution in this article https://medium.com/@ngoctranfire/using-prisma-with-supabase-row-level-security-and-multi-schema-7c53418adba3 |
|
You can now use import { defineConfig, env } from 'prisma/config'
export default defineConfig({
...,
experimental: {
externalTables: true,
},
tables: {
external: [
"auth.audit_log_entries",
"auth.flow_state",
"auth.identities",
"auth.instances",
"auth.mfa_amr_claims",
"auth.mfa_challenges",
"auth.mfa_factors",
"auth.oauth_authorizations",
"auth.oauth_clients",
"auth.oauth_consents",
"auth.one_time_tokens",
"auth.refresh_tokens",
"auth.saml_providers",
"auth.saml_relay_states",
"auth.schema_migrations",
"auth.sessions",
"auth.sso_domains",
"auth.sso_providers",
"auth.users"
],
},
enums: {
external: [
"auth.aal_level",
"auth.code_challenge_method",
"auth.factor_status",
"auth.factor_type",
"auth.oauth_authorization_status",
"auth.oauth_client_type",
"auth.oauth_registration_type",
"auth.oauth_response_type",
"auth.one_time_token_type"
]
},
}) |
I found a solution in this article https://medium.com/@ngoctranfire/using-prisma-with-supabase-row-level-security-and-multi-schema-7c53418adba3
The most important thing is to never reset the database because it gets corrupted.
After running
prisma db pulland creating the migration file, you should set this migration as appliednpx prisma migrate resolve --applied 0_initand DELETE migration record from migrations table in supabase. After this, next migrations works like a charm and everything is working!