remoteFetchAsnc not working in Autoation scripting block (but does work in regular block)


When I run the following in an individual script block on my Base it works without a hitch:

let table = base.getTable("SMS");
let view = table.getView("Real Clicks");
let query = await view.selectRecordsAsync({fields: ["Contact","Shortlink","URL","LinkID","Image"]});

var json_payload = [];

action_injection = {
    'action': 'linkupdater'

let individual_injection = {};

for (let record of query.records) {

    let name = record.getCellValueAsString("Contact");
    let shortlink = record.getCellValueAsString("Shortlink");
    let URL = record.getCellValueAsString("URL");
    let linkID = record.getCellValueAsString("LinkID");
    let imageURL = record.getCellValue("Image");

    individual_injection = {
        'Name': name,
        'URL': URL,
        'Shortlink' : shortlink,
        'LinkID' : linkID
        //'image' : imageURL[0]?.url //['url']


let response = await remoteFetchAsync('', {
    method: 'POST',
    body: JSON.stringify(json_payload),
    headers: {
        'Content-Type': 'application/json',
        'Authorization' : 'Basic d2h5d29udHlvdWNvbm5lY3Q6Y2N1WSAxWWhkIDdsTmkgMzdWSSB5MVlyIDYySEs='

    let body = await response.json();

    console.log("The length of body is: " + body.length);

    for (var key in body) {
        console.log("We are in loop number " + key);
        RecordID = body[key].ID;
        console.log("Record ID is: " + RecordID);
        //ShortLink = body[key].shortURL;
        //console.log("Shortlink is :" + ShortLink);
        //LinkID = body[key].linkID;
        //console.log("LinkID is: " + LinkID);
        Clicks = body[key].clicks;
        await table.updateRecordAsync(RecordID, {
            //"LinkID": LinkID,
            //"Shortlink": ShortLink
            "Clicks": Clicks


However when I copy paste the exact same thing into an automation script block (script block to be triggered by webhook) - I get the following error:

Why does remoteFetchAsync seem to work on individual scripting blocks but not those triggered by Webhooks?

Or am I doing something wrong?


1 Like

I have similar issue. It looks like we cannot use remotefetch and can’t use loops in automation script.
As I have a simialr setup and it doesnt work, frustratingly enough.
Can someone correct me if i’m wrong and perhaps explain why the methods are so different from the blocks/ script extensions?