Seeking clarification on a syntax issue in an Airtable scripting block

Recently, I integrated a basic Airtable script block that sends an update to an API endpoint in my application. However, when I run the script, I receive an error: “SyntaxError: Unexpected token C in JSON at position 0.” I suspect a small mistake might be causing this problem and would appreciate any insights or experiences in resolving such an error.

let authKey = await input.textAsync("Enter your authentication key");
let recordCollection = base.getTable("sampleTable");
let chosenRecord = await input.recordAsync("Select a record", recordCollection);
let contentValue = chosenRecord.getCellValue("contentField");
let uniqueId = "ABC123XYZ";

let chosenEnv = await input.buttonsAsync("Select Environment", ["Development", "Production"]);

let apiData = {
    dataList: [
        {
            code: "5678",
            fullName: "Jane Doe"
        }
    ]
};

let jsonData = JSON.stringify(apiData);
let apiEndpoint = '';

if (chosenEnv === "Production") {
    apiEndpoint = 'https://api.productionservice.com/item/' + uniqueId;
} else {
    apiEndpoint = 'https://api.devservice.com/item/' + uniqueId;
}

console.log(apiEndpoint);
console.log(contentValue);
console.log(jsonData);

let headersSet = new Headers();
headersSet.append("Authorization", "Bearer " + authKey);
headersSet.append("Content-Type", "application/json");

let postParams = {
    method: 'POST',
    headers: headersSet,
    body: jsonData
};

console.log(postParams);

let response = await fetch(apiEndpoint, postParams);
let jsonResponse = await response.json();
console.log(jsonResponse);

hey, seems like your endpoint might be sending back non-json (maybe html). try using response.text() to debug, then fix the actual content. also check that your content field isn’t causing extra output, might b a mismatch