Google Apps Script uncaught error in Chrome Console

◇◆丶佛笑我妖孽 提交于 2021-02-11 12:44:50

问题


I have a simple data entry tool on my Sheet that's an HTML form and then it runs through the fields in the form and posts them to the sheet. The utility works absolutely fine on my home computer. I noticed when a colleague tried it, it failed. I checked his console and there was an uncaught error. I tried the utility on my work computer and it also failed to push the values to the sheet. Almost like there is some type of issue with the google.script.run function? I have had it work for others on different networks. Attached is what it throws in the Chrome console. Not a very descriptive or useful error. I don't get this on my home computer.

My JavaScript:

<script>
  // Prevent forms from submitting.
  function preventFormSubmit() {
    const forms = document.querySelectorAll('form');
    for (var i = 0; i < forms.length; i++) {
      forms[i].addEventListener('submit', function(event) {
      event.preventDefault();
      });
    }
  }
  window.addEventListener('load', preventFormSubmit);
  
  function handleFormSubmit(formObject) {
      $("#formType").val($('title').text());
      google.script.run.processForm(formObject);
      $(".selectpicker").val("default"); // Reset select
      $(".selectpicker").selectpicker("refresh"); // Refresh select
      $("input").val(""); // Reset input values
      $("textarea").val(""); // Reset input values
      $("#waiver").parents().eq(1).css({ display: "none" });
      if ($('title').text() === "PT Credit") {
          var table = $("#credit_table")
          table.parent().css({ display: "none" });
          table.empty();
      }
  }
</script>


回答1:


Check your Apps Script Executions

After some experimenting I have found that whenever I had an uncaught error in the client console, it was always because one of the server side Apps Script functions were failing.

Go to script.google.com > My Executions

Or to your specific project, the executions page:

Seeing as the error only appears on another system, it is likely to be account related. Though there should be more info in the executions page as to why it failed.



来源:https://stackoverflow.com/questions/66038410/google-apps-script-uncaught-error-in-chrome-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!