2

I have an input form I've created that runs in an html modal that opens via in Google App Script in a google sheet that takes values from the google sheet, that users can then edit or manipulate in the form, then write the changes back into the google sheet upon "submission".

I'm getting an issue where two specific users can't appear to use any functions that utilize google.script.run.function() way of calling any functions in the Code.gs file, and I was using that to read cells from the sheet, as well as write values from the form into the sheet.

In an attempt to narrow down if the error is in the function in Code.gs or in the html, I way over simplified my code to this:

TestWindow.html

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <script>
      function testHtml(){
        google.script.run.withSuccessHandler(function (){
          window.alert("Sucess!");
        })
        .withFailureHandler(function (){
          window.alert("Failed!");
        }).testFunction();
      }
      </script>
    <input type="button" id="submit" name="submit" value="Test Button" onclick="testHtml()">
  </body>
</html>

Code.gs

function testFunction(){
  Logger.log("This is a test");
}

function openTest(){
  var ui = SpreadsheetApp.getUi();
  var html = HtmlService.createHtmlOutputFromFile('TestWindow')
      .setWidth(600)
      .setHeight(800);
  ui.showModalDialog(html, 'Test Window:');
}

Most of my users get the success handler response when clicking the test button, but I have 2 users who get the failure handler and the execution log in the Apps Script editor has 0 second duration executions of the "testFunction()" where the execution is un-expandable, with no error listed, just simply "Failed" in the status.

I have checked their version of Google Chrome, and had them update to the latest and still get the above error.

I checked the permission they gave, they have all of the same permissions that the other users agreed to, still get the above error.

My company has some users use a vpn to access certain things, and I connected to the same vpn and I don't get the fail handler on my computer.

All users are logged in as users within the same Google workspace organization, and I tested with my personal account rather than the company account within the organization that owns it, and my personal account responds with the success handler.

Are there possible Chrome settings that could prevent them from using google.script.run? Or possibly user settings that I'm not seeing are different? Is there a possibility that the asynchronous nature of google.script.run is not meshing well with their possibly much slower computers? (I tried adding delays into the code to accommodate some lag time, but no success there, plus the 0 second duration in the execution log leads me to believe that's not the problem). Most users are remote workers, all working on different networks. One of the users lives close to me, so I'm close to driving to their house to see if they still get the fail handler when the access the form logged in on my computer rather than theirs.

3
  • I got success.. Commented Dec 1, 2022 at 22:57
  • Yah, that's the issue. I struggle trouble shooting it because 90% of the user base doesn't fail to call the function. 2 users get the error and can't run my script for some reason, when based on all research I've done, no user should ever get the failure handler with the above code, so figuring out why these 2 users are has been a struggle. Commented Dec 2, 2022 at 22:51
  • I have a similar issue, except in my case I don't see any execution of (my equivalent of) testFunction. I've only done a small scale test - works for me and one other user (and testFunction appears in the execution log), but fails for another. Commented Jun 1, 2023 at 18:24

1 Answer 1

1

I resolved the issue by getting the 2 users to reset their Chrome settings by navigating:

  1. Three dots in top right corner
  2. Settings
  3. "Reset and Clean Up" on the left hand side
  4. "Restore Settings to their original defaults"

I still don't know what was causing the issue exactly. If it was an extension they had installed, or a setting somewhere in Chrome, but either way it was resolved by re-setting their settings.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.