
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 30, 2020 01:33 PM
I have been attempting to catch a hook in Zapier from a scripting app that I run daily. The content of the request is designed to capture some metrics from the actual running of the script.
I have previously run caught a webhook from a scripting automation to Zapier with no issues. For some reason though, when trying to send a similar request through a scripting app I encounter a failed to fetch issue with some writing on CORS.
My code is below, I removed the link within the fetch but it was just the link that Zapier provides within their catch hook step.
var bodyContent = {
"scriptName": script,
"numOfRecs": numRecs,
"elapsedTime": et,
"recsPerSec": recsPerSecs
}
let request = await fetch('', {
method: 'post',
body: JSON.stringify(bodyContent),
headers: {
'Content-Type': 'application/json'
},
});
This is the error that is happening when I attempt to perform this part of the script.
Thank you for the help!
Solved! Go to Solution.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 30, 2020 02:00 PM
hmm, something definitely changed as I am seeing same as you and it previously worked.
Luckily its an easy fix thanks to this: https://zapier.com/help/create/code-webhooks/troubleshoot-webhooks-in-zapier#posting-json-from-web-b...
Just comment out your Content-type header and it seems to be working for me now.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 30, 2020 02:00 PM
hmm, something definitely changed as I am seeing same as you and it previously worked.
Luckily its an easy fix thanks to this: https://zapier.com/help/create/code-webhooks/troubleshoot-webhooks-in-zapier#posting-json-from-web-b...
Just comment out your Content-type header and it seems to be working for me now.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 30, 2020 02:03 PM
BTW - this is crazy timing, we literally just released our newest article explaining how to do this:
(We need to remove the header from our code sample now :slightly_smiling_face: )

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 30, 2020 02:53 PM
Scripting App and Automation scripts handle CORS differently. Automation scripts don’t have CORS limitations, per this support article.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Sep 16, 2024 04:07 AM
Guys, I'm just popping in because I had the same issue but solved it using remoteFetchAsync instead of fetch
