BBAzn
BBAzn7mo ago

how do i make an API call to a supabase function? I have the variable to pass its just one variable.

how do i make an API call to a supabase function? I have the variable to pass its just one variable. Please provide examples. I am having trouble with the buildship syntax.
Solution:
Hey, @Russell, You can click the node info tooltip to get the steps on how to create a Supabase RPC function and use it. Here's an example function I used to test the RPC node.
BEGIN
RETURN 'Hello, ' || name || '!';
END;
BEGIN
RETURN 'Hello, ' || name || '!';
END;
...
Jump to solution
6 Replies
Russell
Russell5mo ago
This is exactly what I came to discord for. Disappointed there's no answer in a month. 😦
Gaurav Chadha
Gaurav Chadha5mo ago
Hi @Russell, the above question was answered in this thread - https://discord.com/channels/853498675484819476/1218184257206222949/1218207158961700864. Could you please elaborate more if this doesn't helps, since then we have added more resources on Supabase you may want to check - https://docs.buildship.com/database/supabase.
Russell
Russell5mo ago
Thank you... I think I'm doing something really simple... I have a series of nodes that gets some data for me and then I want to call a Postgres function on Supabase: SELECT public.save_questions(' { "content": "<string from Replace String node>" }'); To do this from BuildShip I am using the Supabase RPC node - I've got the URL, Key, and Function Name working - but I have no clue how to pass the string coming from the Replace String node higher in the workflow... No matter what I do I get some kind of error - been working on it for four hours - just the darn syntax of how to pass a single unnamed parameter to the RPC function... or named... here's the function declaration incase that helps: CREATE OR REPLACE FUNCTION public.save_questions(_question_list text) Read through all of that... I'm trying this: '_question_list' : ${['ctx["root"]["0836c6ac-ebb9-46fb-9af6-17d27a28fd68"]']}; and getting an "Unexpected token '{'" reply. Somehow my Node now has a field called "Replace String" which I think it somehow got from the prior node... 😦 No idea if it needs to be renamed. Just dropped the node and rebuilt it. Now I've got "Could not find the function public.save_questions without parameters in the schema cache." Still don't know how to pass a parameter to Supabase RPC - which feels like it should be pretty easy to get from documentation - but I can't find a single example. Been working on this for almost two days - super frustrating... there is ZERO documentation on the Supabase RPC node as built... no idea how to make this work.
Solution
Gaurav Chadha
Gaurav Chadha5mo ago
Hey, @Russell, You can click the node info tooltip to get the steps on how to create a Supabase RPC function and use it. Here's an example function I used to test the RPC node.
BEGIN
RETURN 'Hello, ' || name || '!';
END;
BEGIN
RETURN 'Hello, ' || name || '!';
END;
Russell
Russell5mo ago
Thanks @Gaurav Chadha ... I found that after about a day of struggle searching... I think the issue is in the complications of two different systems and I happen to be learning both BuildShip and Supabase (came from C#/Java and MSSQL/MySQL background; just not caught up on the nuances yet). I don't know if my PostgreSQL function should accept text or json or jsonb... I don't know how I should prepare the send from the BuildShip side. I just wish the documentation was expanded a bit to explain how to call a Supabase RPC; I need the benefit of database transactions (if one part of the database calls fail they all roll back), so the nodes won't accomplish what I need. I'll continue working hard on this... I'm so close to feeling like BuildShip is the backend I need to deploy more quickly. I'm hopeful that the Blank Script (haven't had a chance to read it thoroughly) might be better identified as a "code node" where users can do just about anything (including add packages and SDKs)? 🙂