Feb 08, 2024 01:38 AM
I have two buttons on the same table, each triggers a script and then sends a webhook to a third-party service. One works and the other does not. During the debugging process, I copy and paste the exact same code into the two scripts, and one works, but the other always says "O: TypeError: Failed to fetch at line 10" and that's the line that triggers the Webhook. It's rather strange given the two scripts are identical. Is there any limitation that one cannot have two scripts within one table? My code below.
let table = base.getTable('URL');
let record = await input.recordAsync('Select a record', table);
let websiteContent = record.getCellValue('Website_Content'); // Retrieve the content from "Website_Content" column
let recordId = record.id; // Get the record ID
// Include the record ID and the website content in the webhook payload
let payload = JSON.stringify({ websiteContent: websiteContent, recordId: recordId });
// Send the data to the Azure Function
let response = await remoteFetchAsync('my webhook url', {
method: 'POST',
body: payload,
headers: {
'Content-Type': 'application/json'
}
});
let result = await response.json();
// Optionally update the Output column with a placeholder or message until the async process completes
await table.updateRecordAsync(record.id, {
'Website_Content': "Processing..." //
});
Feb 08, 2024 09:22 AM
Anyone had similar experience before? I have tested it multiple times, in same table, different table, same base, different base. Exact same code, same trigger. My original one works, but all the others have the same error. Any pointers would be very much appreciated!
Feb 10, 2024 04:47 AM
Sorry, I don’t know much about scripting, but here are the 2 different scripts that I use to send Airtable records to Make’s custom webhooks:
https://air.tableforums.com/t/sending-airtable-data-to-an-external-webhook-such-as-make-com/159