Closed scshiv29-dev closed 1 year ago
For future reference, restarting Supabase locally with supabase stop && supabase start
does fix the issue. If you're working with the remote Supabase instance, there's a button in the dashboard to restart the database.
✍🏼 More details
This happened by following the instructions properly for the Supabase adapter, leading to this error in the terminal :
# this is returned even though the `next_auth` schema is exposed on supabase
# but the database instance has not been restarted
[next-auth][error][adapter_error_getSessionAndUser]
https://next-auth.js.org/errors#adapter_error_getsessionanduser The schema must be one of the following: public, storage, graphql_public
{
code: 'PGRST106',
details: null,
hint: null,
message: 'The schema must be one of the following: public, storage, graphql_public'
}
💡 PGRST106 : The schema specified when switching schemas is not present in the db-schemas configuration variable.
I can make a PR explaining this for the supabase adapter docs if you feel this is useful @balazsorban44 ?
Yeah, clarifying the docs is welcome.
Hi, for me restarting Supabase does not solve the issue! I'm having Supabase self-hosted - is this a limitation?
@rbrueckner so go to your project settings>API> add next_auth schema u created from the docs here
Where do I find "project settings" in a self-hosted Studio?
@rbrueckner aah that's something I don't know, maybe in the project section ? can you send a screenshot of the ui?
@rbrueckner you can use your local config.toml
of supabase
@rbrueckner so go to your project settings>API> add next_auth schema u created from the docs here
This works. Thanks.
@farid98 There is no settings option in self-hosted projects
@SrDouglax Have you found a way to expose the schema in a self-hosted project?
@farid98 There is no settings option in self-hosted projects
normally you have a config.toml
where you set your schemas:
[api]
schemas = ["public", "storage", "graphql_public", ...]
For those who might not be familiar with local development with docker, the following might be helpful:
once you pull your public schemas, supabase cli recommends another command like:
The auth and storage schemas are excluded. Run
supabase db pull --schema auth,storage
again to diff them.
try to add "next_auth" to this command: supabase db pull --schema auth,storage,next_auth
once the new migration files are generated, you can push them to your local by running: supabase db push --local
otherwise, next_auth schema won't show up in your local studio.
additionally, you can generate types by running:
supabase gen types typescript --local --schema public > types_db.ts
I have changed config.toml and restarted docker, I have still same error. Is there solution for that?
EDIT: I have found solution: ALTER ROLE authenticator SET pgrst.db_schemas TO 'public, storage, graphql_public, myschema'; NOTIFY pgrst;
Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!
Environment
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth"
System: OS: Windows 10 10.0.19044 CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor Memory: 7.41 GB / 15.93 GB Binaries: Node: 16.15.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD npm: 8.5.3 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.1266.0), Chromium (107.0.1418.56) Internet Explorer: 11.0.19041.1566 npmPackages: next: 13.0.5 => 13.0.5 next-auth: ^4.17.0 => 4.17.0 react: 18.2.0 => 18.2.0
Reproduction URL
na
Describe the issue
getting the above mentioned issue when using supabase adapter.
How to reproduce
Add supabase adapter and try to sign in
Expected behavior
User account creation.