Hello, in my Google Sheet, i have setup an automatic deployment script, that basically deploys the GAS when clicked on a button in my Sheet document:
function deployWebApp() {
let scriptId = ScriptApp.getScriptId();
var params = {
"method": 'GET',
'muteHttpExceptions': true,
headers: {
Authorization: `Bearer ${ScriptApp.getOAuthToken()}`,
},
"versionNumber": 123,
redirect: "follow",
}
var response = UrlFetchApp.fetch(url, params);
var deploymentURL = null;
if ( response && JSON.parse(response.toString()).deployments) {
SpreadsheetApp.getUi().alert('Web App deployed Successfully - Check the URL and newly generated password for accessing the app' );
}
My goal is to get the Sheet's data from remote website.
deploymentId generated by deployWebApp function is this "AKfycbxnSlOb2p_Q676aG7SSaRnriBGRjVzdzi8oZQrrBAdG"
Web App Url generated by this deployment causes CORS error when requested to get the data.
But if I deploy the GAS manually, the deploymentID is much longer: AKfycbxn5zZ8SsAQmQSTPsEskpPDAy5EsDZp5vEsur6gACRL8gWaUd7BtrT4jA4d_WbWOd-r4A
Web App Url generated by manual deployment works.
Please let me know if you need more context to understand what could be issue.
I've spent many hours trying to figure out what is the problem......