Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The schema must be one of the following: public, storage, graphql_public #5884

Closed
scshiv29-dev opened this issue Nov 24, 2022 · 16 comments
Closed
Labels
incomplete Insufficient reproduction. Without more info, we won't take further actions/provide help. triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@scshiv29-dev
Copy link

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.

@scshiv29-dev scshiv29-dev added the triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. label Nov 24, 2022
@balazsorban44 balazsorban44 added the incomplete Insufficient reproduction. Without more info, we won't take further actions/provide help. label Nov 28, 2022
@thisfrontenddev
Copy link

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 ?

@balazsorban44
Copy link
Member

Yeah, clarifying the docs is welcome.

@rbrueckner
Copy link

Hi, for me restarting Supabase does not solve the issue! I'm having Supabase self-hosted - is this a limitation?

@scshiv29-dev
Copy link
Author

@rbrueckner so go to your project settings>API> add next_auth schema u created from the docs here
image

@rbrueckner
Copy link

Where do I find "project settings" in a self-hosted Studio?

@scshiv29-dev
Copy link
Author

@rbrueckner aah that's something I don't know, maybe in the project section ? can you send a screenshot of the ui?

@thiras
Copy link

thiras commented Mar 21, 2023

@rbrueckner you can use your local config.toml of supabase

@farid98
Copy link

farid98 commented Feb 2, 2024

@rbrueckner so go to your project settings>API> add next_auth schema u created from the docs here image

This works. Thanks.

@SrDouglax
Copy link

@farid98 There is no settings option in self-hosted projects

@swingislee
Copy link

@SrDouglax Have you found a way to expose the schema in a self-hosted project?

@nietsmmar
Copy link

@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", ...]

@kayaayberk
Copy link

kayaayberk commented Jun 10, 2024

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

@Cansiano

This comment has been minimized.

@jetset1989
Copy link

@nietsmmar thanks a lot

@g-wozniak
Copy link

Don't forget to modify the custom schemas in config.toml if you're talking about the local instance. The migration won't fix it for you.

@UdaraWanasinghe
Copy link

@swingislee Append your schema to the PGRST_DB_SCHEMAS env variable and recreate the docker containers.

docker compose stop
docker compose up -d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete Insufficient reproduction. Without more info, we won't take further actions/provide help. triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests