Hi everyone,
I’m executing a post request via the customer script app pointing to an integromat webhook to trigger an automation. The integromat scenario takes a while to run (approx. 45 seconds), as it duplicates heavy Google Slides presentations.
The scenario ends by a the simple webhook response such as this one:
{
"body": {"message":"Scenario successful."},
"status":200
}
I’m receiving the following error:
Unexpected token A in JSON at position 0
This would normally indicate that the JSON string is malformatted and can’t be parsed. But a few tests, it looks like the await response.json() line is executed before the response is actually returned from integromat (it waits ~40seconds for a response before moving on).
I have tested a mock scenario (running in a few seconds) returning the same json string and it works just fine.
According to the researches I’ve made, default fetch()
requests timeout at the time indicated by the browser which would be 300 seconds in Chrome, but I’m wondering if there is any extra limitation coming from the scripting block environment?
Here is the code I’m executing:
const options = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json;charset=UTF-8'
},
body: body
};
var response = await fetch(url, options)
var data = await response.json();
Thanks a lot for your help!