Hey!
I’m trying to send an array of customer data to an API webhook on a external service (e.g. Sendgrid/Zapier), using a POST request in a scripting block.
Using the basic fetch() function, CORS is preventing it to work.
Using a CORS proxy like https://cors-anywhere.herokuapp.com/ isn’t an option because I don’t want to send sensitive data through this service.
What’s the best way to fix this?
Best
Dominik
Best answer by Erin_OHern
Hi Dominik,
Thanks for posting! We have a new feature currently in beta to solve this exact problem – you can read more and sign up at the link here!
Happy New Year!
We’re excited to open up a beta for a new remoteFetchAsync function in the Scripting App.
One of the most common issues we see users run into when writing scripts is in trying to use the fetch API to communicate with an external service. Because Scripting App scripts run directly in the user’s browser, fetch requests will be blocked by the browser if the target server doesn’t support Cross-Origin Resource Sharing (CORS) .
The new remoteFetchAsync method transmits the request fr…
Hope this helps :blush:
View original