I’m using Apps Script in Google Sheets. I open a dialog (which works fine) and then when I click the Go
button I expect handleGo
to run and display “GO-ing!”. It works fine on Chrome, but on Safari (17.4.1) it alerts: “Error: ScriptError: We’re sorry, a server error occurred. Please wait a bit and try again.”
There is no additional information on the error in the Javascript console or in the app script execution log. I have tried disabling cross-origin restrictions as well as disabling prevent cross-site tracking in Safari. I am logged in with the correct google account.
Here’s my code:
Code.gs
function openDialog() {
var html = HtmlService.createHtmlOutputFromFile('Dialog.html').setWidth(300).setHeight(150);
SpreadsheetApp.getUi().showModalDialog(html, 'Test Dialog');
}
function handleGo() {
SpreadsheetApp.getActiveSpreadsheet().toast("GO-ing!")
}
Dialog.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
function go() {
google.script.run
.withSuccessHandler(function() {
alert("Function executed successfully");
})
.withFailureHandler(function(error) {
alert("Error: " + error);
})
.handleGo();
}
</script>
</head>
<body>
<button onclick="go()">Go</button>
</body>
</html>
Scott Brave is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.