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

Clarification on rpc #14

Open
pianomanfrazier opened this issue Jul 15, 2023 · 1 comment
Open

Clarification on rpc #14

pianomanfrazier opened this issue Jul 15, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@pianomanfrazier
Copy link

Improve documentation

Link

RPC section of the readme. https://github.com/supabase-community/supabase-custom-claims#getting-claims-data-from-the-server

Describe the problem

I can run the functions on the database in the supabase SQL editor. But when I try to run them in a server function in a Netlify serverless function I get an error saying:

Searched for the function public.get_claim with parameters claim, uuid or with a single unnamed json/jsonb parameter, but no matches were found in the schema cache.

Here is how I called the rpc.

const options = {
    auth: {
      persistSession: false,
      autoRefreshToken: false,
      detectSessionInUrl: false,
    }
  };
  const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_API_KEY, options);
  const { data, error } = await supabase
   .rpc('get_claim', {uuid, claim});

I would expect if it were an auth problem I would get an authentication error.

I tried to reset the schema cache with NOTIFY pgrst, 'reload schema'; But it didn't change anything.

@pianomanfrazier pianomanfrazier added the documentation Improvements or additions to documentation label Jul 15, 2023
@pianomanfrazier
Copy link
Author

K. I've resolved this. First thing is that my rpc call needed to match exactly. Dumb mistake. Reviewing the generated docs helped.
image

The second part of my problem was resolved by the open pull request. #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant