Skip to content

rpc not automatically typing response #430

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

Closed
2 tasks done
bombillazo opened this issue May 26, 2023 · 2 comments
Closed
2 tasks done

rpc not automatically typing response #430

bombillazo opened this issue May 26, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@bombillazo
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

The supabase client is not automatically typing RPC functions all responses based on the generated Database type.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a DB function in your database
  2. Generate DB types with CLI
  3. Create a supabase client, type with generated Database type.
export const supabase = createClient<Database>(
  env.SUPABASE_URL,
  env.SUPABASE_ANON_KEY,
);
  1. Use the RPC function with the client.
const response = await supabase.rpc('my_function', data);
  1. Response is untyped

Expected behavior

The supabase client automatically types the RPC response based on the Database schema types

Screenshots

image

Working if the types are explicitly passed:

image

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

@bombillazo bombillazo added the bug Something isn't working label May 26, 2023
@steve-chavez steve-chavez transferred this issue from supabase/supabase-js May 27, 2023
@soedirgo
Copy link
Member

Can you provide your CLI version & supabase-js/postgrest-js versions? We have a test for RPC return types so not sure how this happened.

@bombillazo
Copy link
Author

i think this is solved, probably an intermediary cli version was fixed and now works. closing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants