Hey there,
I am having trouble invoking a supabase edge function using the provided workflow action.
I tried for quite some time now, but it always gave me a bad body / bad json error.
Invoking my function in Postman works and writing a small JS that fetches from my function also works without problems.
I tried all sorts of variations in the body field of the Supabase Action from a string like so '{“email":"myemail@example.com”}" over an “object” just like this: {“email":"myemail@example.com”} to using the “createObject” function and building an object.
It is NOT a Cors issue, since my JS call also worked and I just modified my edge function to expect a GET call as well and using the GET with a key:value like above it worked fine.
So now my question: What am I doing wrong?
Is there a problem with the action or do I have to modify my code somewhere or does the body has to be formatted in a way I could not find any documentation for? Also checked the forum, but could not find anything in that regard.
I think I ran into the same thing earlier (don’t quite remember). It sounds odd, but can you try to switch to JavaScript instead of formula and manually put:
@DanielL I tested with the Rest API Plugin and it works with a post request and a body like this “{“email":"abc@abc.com”}” (just in my easy javascript fetch example from my first post).
@Kawwl
Thanks for the tip, but unfortunately this one also does not work. Before I tried already, but I forogt the “return”, for the JS statement. However that did not make the difference unfortunately.
So I think it has to do something with the Supabase Function invocation Action in Post mode not being able to correctly transmit my body content.
@Nils if it works with the REST API plugin, then there is probably something off with the plugin. If you have time, please create a ticket here with your editor link and the steps to reproduce the issue for us to check if it’s a bug: https://support.weweb.io/
It’s pretty hard for anyone to give advice any further than what’s been given without any pictures of what you’re doing and/or code snippets. In fact I’ll change that it’s impossible for anyone to help any further, everyone’s only guessing even now what the issue is. Pictures and code snippets make a huge difference to how much help people can give.