개발 공부

[supabse] custom schema 사용시 발생 에러 error code name PGRST106

solutionMan 2025. 5. 21. 23:44
반응형

수퍼베이스 대시보드에서 아래 쪽으로 이동을 한후에 사용하고자하는 신규 스키마를 expose 시켜주면 된다.

 

 

 

 {
  code: 'PGRST106',
  details: null,
  hint: null,
  message: 'The schema must be one of the following: public, graphql_public, tcrc'
}

 

 

추가로 이렇게 설정한 이후 @supabase/supabase-js 라이브러리 통해서 할경우

아래 코드와 같이 .schema를 지정해서 사용한다 하지 않을경우 public이 default이다.

// Initialize the JS client
import { createClient } from '@supabase/supabase-js'
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, { db: { schema: 'myschema' } })

// Make a request
const { data: todos, error } = await supabase.from('todos').select('*')

// You can also change the target schema on a per-query basis
const { data: todos, error } = await supabase.schema('myschema').from('todos').select('*')

 

 

참고 

 

Using Custom Schemas | Supabase Docs

You need additional steps to use custom database schemas with data APIs.

supabase.com

 

 

The schema must be one of the following: public, storage, graphql_public · Issue #5884 · nextauthjs/next-auth

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...

github.com

 

반응형