I have an edge function that return object data.
When I test it and send the following in the body:
{
“supplierId”: “82004”
}
I get the correct response.
In weweb, I’m not sure what is mandatory to configure and how to bind the body correctly.
I tried binding javascript to the body, but with no success:
return [{ key: ‘supplierId’, value: globalContext.pageParameters[‘id’] || ‘82004’ }]
Any advice?
Try passing an object, not an array
tried this:
{
“supplierId”: “82004”
}
still no result
You must get some answer when testing, maybe even an error. Check out the logs
name: “Error”
stack: “Error: Failed to send a request to the Edge Function at Object.invokeEdgeFunction (https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/6d5dd36e-d77a-4054-901e-806ac8c56554/dist/ma…”
message: “Failed to send a request to the Edge Function”
cause
name: “FunctionsFetchError”
status: undefined
data: undefined
context
Check the API call result in the browser’s DevTools >> “Network”
you should clear the contents and after that make your API call. Then you will be able to inspect the result.
This is a JavaScript error, nit a neteork error I think
yeah, maybe. I had several workflows in my project that resulted in the same unrecognizable error inside the editor, but in the dev tools I found a real hint to solve the problem.
I don’t quite remember what the issues were (I suppose CORS issue or changing the general API endpoint URL in Xano)
Flo just fixed this for me on OO: the issue was in the edge function. I needed to update the CorsHeaders. I was missing some of the values.
“Access-Control-Allow-Headers”: "Content-Type, Authorization,x-client-info, apikey, content-type