There was an error during the transport or processing of this request. Error code = 10, Path = /wardeninit
Asked Answered
E

8

12

I'm trying to pass an object (contents of a sheet row) to an apps script template. You can see the row in the screenshot.

enter image description here

my function in apps script contains:

var sendableRows = rows.filter(function (row) { //ONLY CHECKED ROWS.
  return row['Index'] == true;
});  
var sendableRow = sendableRows[0];
Logger.log('sendableRow '+ JSON.stringify( sendableRow));

var html = HtmlService.createTemplateFromFile('RowPopup');
html.row = JSON.stringify(sendableRow);
var h =html.evaluate();

SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
  .showModalDialog(h, 'Create Documents');

The logger statement produces:

 sendableRow {"Index":true,"Timestamp":"2019-02-12T21:09:14.000Z","FROM":222222,"CONVERSATION":"THIS IS A TEST","ME":"","relativeRow":14,"absoluteRow":15}

My Rowpopup.html is :

<!DOCTYPE html>
<html>
<head>
  <base target="_top">
  <script>
    // Prevent forms from submitting.
    function preventFormSubmit() {
      var forms = document.querySelectorAll('forms');
      for (var i = 0; i < forms.length; i++) {
        forms[i].addEventListener('submit', function(event) {
          event.preventDefault();
        });
      }
    }
    window.addEventListener('load', preventFormSubmit);

    function handleFormSubmit(formObject) {
      // the output from form goes to processDocBuildHtml
      google.script.run
          .withSuccessHandler(updateUrl)
          .processRowPopupHTML(formObject);
    }

    function updateUrl(url) {
      var div = document.getElementById('output');
      div.innerHTML = '<a href="' + url + '">Sent!</a>';
    }
  </script>
</head>

<body>
  <form id="myForm" onsubmit="handleFormSubmit(this)">

    <div>
      <label for="optionList">Click me</label>
      <select id="optionList" name="email">
        <option>Loading...</option>    
      </select>
    </div>

    <br>
    <div>
    </div>

    <br>
    <div>
      <textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
      </textarea>
    </div>
    <div id="textboxes"></div>

    <div id="insert"></div>

    <input type="submit" value="Submit" />
  </form>

  <div id="output">
  </div>

  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
  <script src="//rawgithub.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.js"></script>
  <link href="//rawgithub.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.css" rel="stylesheet">

  <script>
  function getConversations() {
    var jsonRow = <?= row ?>; //PASSED IN JSON
    console.log('row');
    var myObj = JSON.parse(jsonRow);
    console.log(myObj['CONVERSATION']);

    return myObj['CONVERSATION'];
  }
  </script>
</body>

When I run this I see:

enter image description here

Which shows some issue with "warden".

Also, I don't see the expected data outputted to console in:

       console.log('row');
       var myObj = JSON.parse(jsonRow);
       console.log(myObj['CONVERSATION']);

What am I doing wrong?

Equipoise answered 18/2, 2019 at 14:28 Comment(1)
Server side code isn't complete and the client-side codes has more code than needed to reproduce the problem :) Ref. minimal reproducible example.Madrigal
M
13

Your client side code never calls getConversations, that is why you don't see it on the console. Among many ways to do this, you could add an IIFE to call that function by adding the following on between <script> tags

(function (){getConversations()}());


By the other hand, the referred error message on the Chrome Developers Tools Console occurs even with the simplest code like the following
function myFunction(){
  var html = HtmlService.createHtmlOutputFromFile('index');
  SpreadsheetApp.getUi().showModalDialog(html, 'Test')
}
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    Hello world!
  </body>
</html>

So it's not you, it's Google

Madrigal answered 18/2, 2019 at 23:37 Comment(0)
A
5

I know this answer is not related to this OP and the place I should post is not appropriate, but for the other people who reach this page in future, I leave an answer here because I struggled to solve similar problems.

I think this error means we cannot connect from an HTML file to the scripts written in Script Editor.

So basically you can ignore this error message(maybe. If not, tell me the correct feature.)

To me, the error has occurred when executing google.script.run.myFunction(). So, at the first, I thought the error prevents this execution. However, the error was completely unrelated to this execution. It was another problem and I detected why my issue had happened by using withFailureHandler(onFailure). It emits an error message. (See more information at https://mcmap.net/q/791945/-why-does-my-apps-script-deployed-as-api-executable-return-permission-denied)

As Mr. Rubén says "So it's not you, it's Google", this error can be replayed, easily. Please don't be puzzled by this message. The error message("There was an error during the transport or processing of this request. Error code = 10, Path = /wardeninit") is useless, I think. Ruben's great post is this -> https://mcmap.net/q/926612/-there-was-an-error-during-the-transport-or-processing-of-this-request-error-code-10-path-wardeninit

Acyclic answered 9/10, 2020 at 7:46 Comment(0)
R
2

You have only declared the function getConversations. It's not executed until call it (). To execute directly on loading, try

(function getConversations(){})()
Rossman answered 18/2, 2019 at 16:25 Comment(0)
S
0

My solution: use versioned deployments of library scripts.

I had a similar issue where I was unable to run my own functions from the sidebar in Google Sheets. The issue seemed to be connected with using a library, even though the scripts that I was attempting to execute were not dependent on the library.

When the library was connected to the container script i couldn't get functions in the sidebar to execute. When I removed the library it all worked fine. I was using the head version of the library, meaning the most current development. I decided to try managing deployments and creating versions of the project. I added a Library deployment and version, then updated my library reference, and everything works again.

References:

Why does my apps script deployed as API executable return Permission Denied?

https://developers.google.com/apps-script/concepts/deployments

A descriptive alert from Google would be helpful.

Shandrashandrydan answered 27/1, 2021 at 18:46 Comment(0)
S
0

To anyone getting this error. Try to run the code in another browser, Safari, or in guest mode. In my case, it was probably some extension, I'm still not sure but I have already spent hours on this so I won't further investigate.

Standstill answered 10/12, 2022 at 14:50 Comment(0)
A
0

I just changed my WiFi and error gone. Why is that - i dont know, but still it works

Absorbed answered 30/11, 2023 at 18:11 Comment(0)
N
0

Just spent several hours on this issue. What fixed it for me was going from

let url = `https://...`

to

let url = 'https://...'

See this issue on the Google issue tracker for more details https://issuetracker.google.com/issues/298799211

Noguchi answered 24/7, 2024 at 16:45 Comment(0)
C
-2

I had a similar problem. But in my case, most of my users didn't have the issue. Just some users in some PCs. Then I found out that, in these cases (about 10%), if they installed Firefox and ran the app, everything worked just fine. So that was my solution: suggest Firefox when this behavior occurred.

Commutator answered 28/6, 2020 at 23:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.