I’m dipping my toe into scripting in automations and I’m having trouble with a simple script. I can’t seem to get a response even though the script works fine in postman. What am I doing wrong?
const http = context.getService(‘http’);
try {
// GET request to auth endpoint
const response = await http.getAsync(‘https://readwise.io/api/v2/auth/’, {
headers: {
‘Authorization’: ‘Token XXX’
}
});
// Throw an error with the response status to check if the request was successful
throw new Error("Readwise API response status: " + response.status);
} catch (error) {
// If there’s an error, throw it to display in the Fibery app
throw new Error(error);
}
Here’s the error: Failed to execute Action “Script”: Error: Readwise API response status: undefined