Post to webhook fails with [AxiosError, Network Er...
# 🤝help
l
I'm trying to post to my webhook with code execution. AI generated code is: const webhookUrl = "https://mywebsite.com.url/hooks/webhookurl" const payload = { name: workflow.name, phone: workflow.phone } await axios.post(webhookUrl, payload) Error generated was 16:58:33debugEntering workflow (flow:Error) [node:Entry] from (flow:Main) [node:Call_Back] 16:58:33debugTransition from (flow:Error) [node:Entry] to [node:Standard] 16:58:33debugSending Message. Type: text. Text: Sorry, an error occurred. Please try again later Any advise? Edit: the webhook works when i use curl on terminal. curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "Testing \nThis is more test. 🎉"}' htps://URL
a
hey @little-scientist-91622, are you making your call to https://mywebsite.com.url or is that just a placeholder?
l
it's a place holder
a
Have you verified that the request works with a program like Postman or a cURL in terminal?
l
yes it works in command line curl curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "Testing \nThis is more test. 🎉"}' http://url.placeholder.com/webhook runs successfully and i receive my message.
a
strange. @famous-zoo-73118 do you know if our axios proxy applies to webhooks as well as it does to normal endpoints?
l
It's an external url.
I changed the code to fetch and it works now, found the solution here: https://discord.com/channels/1108396290624213082/1126950401741168693 I'm pretty sure it's related.
c
Hey @little-scientist-91622 , we use a proxy when you are on the Studio, but it's not being used when the bot has been published. It's a limitation of CORS calls within the browser.. If you publish your bot and chat with it, does it works ? Would help pinpoint the issue
l
@colossal-activity-12523 I did try it with a published bot, it didn't work as well. Using fetch worked.
b
active
73 Views