Hello,
I am writing an OfficeScript that for now only has one simple function to send a GET request. For now nothing actually needs to happen with the response. My script is configured like below.
As you can see it is a very simple request, only the Authorization header is different from the examples in the official documentation. The request URL itself also works and is tested with multiple different tools. I cant share the request URL for security reasons.
OfficeScript returns the error: Failed to fetch. Without any further explanation. Interestingly enough, when I add 'mode': 'no-cors' to the configuration parameters then the request works, but the json is not readable. So I think it could have something to do with cors.
Can you please help me understand why the request does not work or how I could see a more insightful error message?
async function main(workbook: ExcelScript.Workbook) : Promise <void>
{
// Provide the request configuration
var configurationParams = {
'method': 'GET',
'headers': {
'Authorization': '<some API KEY>'
}
};
const response = await fetch('<some request URL>', configurationParams);
}