Assigned
Status Update
Comments
jp...@google.com <jp...@google.com> #2
Generated Metadata
- Summary: There appears to be an issue with google.script.run callbacks not firing in HtmlService modeless dialogs or sidebars within Google Sheets. The success and failure handlers are not being invoked on the client side, even though the server-side function is likely processing the request and sending a response.
- Tags:
Additional resources:
https://stackoverflow.com/.../google-apps-script-withsuccesshandler-doesnt-... https://www.reddit.com/.../GoogleAppsScript/.../googlescriptrun_not_runni... https://stackoverflow.com/.../google-script-run-withsuccesshandler-creating... https://stackoverflow.com/.../google-script-run-withsuccesshandler-does-not... https://www.reddit.com/r/GoogleAppsScript/.../googlescriptrun_not_workin...
You can
bl...@google.com <bl...@google.com> #3
Automated by Blunderbuss job workspace-devrel-public-issue-tracker-blunderbuss-autoassigner for config assign for component 191640.
Description
Description When using google.script.run from an HtmlService modeless dialog (or sidebar) within Google Sheets to call a server-side Apps Script function, the registered callback handlers (withSuccessHandler and withFailureHandler) are not being invoked on the client side.
Extensive client-side logging confirms:
The google.script.run.MY_FUNCTION() call is initiated successfully without synchronous errors. Both .withSuccessHandler(handleSuccess) and .withFailureHandler(handleFailure) are registered immediately before the call. Browser network logs (XHR requests to /callback?..., Net state changes) indicate that the server is likely processing the request and sending a response. However, neither the handleSuccess function nor the handleFailure function is ever executed, according to client-side console logs. The client script effectively hangs waiting for a callback that never arrives. This issue persists even when:
The server-side function (getProgressStatus in the example) is simplified to return only a basic, hardcoded JavaScript object { completed: false, messages: ["Test..."], result: { test: true } }. This rules out problems with complex return types or server-side errors. The client-side HTML (ProgressDialog.html in the example) is reduced to a minimal implementation with extensive logging focused solely on the google.script.run call and its callbacks. The test is run in an Incognito/Private browser window, ruling out interference from browser extensions. This strongly suggests a potential bug or environmental issue within the Apps Script HtmlService execution environment or the google.script.run communication bridge itself, preventing the reliable delivery of callbacks to the client-side JavaScript.
Code Code.gs (Minimal Server Function):
ProgressDialog.html (Minimal Client with Verbose Logging):
Output Expected Output: The client-side logs (in the browser console and the dialog's log area) should show the poll being initiated, followed shortly by either: ----> SUCCESS Handler Executed... or !!!!> FAILURE Handler Executed...
Actual Output: The client-side logs show the poll being initiated successfully: [XX.XXXs] (SUCCESS) google.script.run.getProgressStatus() call INITIATED for poll #1. Waiting for callback... However, neither the success nor the failure handler log message ever appears. The script execution on the client effectively stops at this point, waiting indefinitely. Browser network logs may indicate that the server call completed, but the callback is never triggered in the JavaScript environment. (See attached screenshots/logs if possible - [You would attach your screenshots here]).
Steps