title: Google HTML script failing to call server side function: "a server error occurred while reading from storage. Error code PERMISSION_DENIED."
body: <p><strong>Currently</strong></p>
  <p>I have a sidebar in Google Sheets (launched on open using a project trigger) with a button that is meant to call a script from a <code>.gs</code> file
  <a href="https://i.stack.imgur.com/ZGSWU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZGSWU.png" alt="enter image description here" /></a></p>
  <p>The code:</p>
  <p><em>.gs</em></p>
  <pre class="lang-js prettyprint-override"><code>function addSideBar() {
    var html = HtmlService.createHtmlOutputFromFile('Index')
        .setTitle('My Sidebar')
        .setWidth(500);
    SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
        .showSidebar(html);
  }
  
  function logMe() {
   console.log(&quot;I am a log!&quot;); 
  }
  </code></pre>
  <p><em>.html</em></p>
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;base target=&quot;_top&quot;&gt;
    &lt;/head&gt;
    &lt;body&gt;
       &lt;button value=&quot;Connect&quot; name=&quot;Connect&quot; onclick=&quot;connect()&quot;&gt;Connect&lt;/button&gt;
    &lt;br&gt;
      &lt;script&gt;
      
      function connect() {
          google.script.run
          .withSuccessHandler(function() {console.log(&quot;More Success!&quot;)})
          .withFailureHandler(function(err) {
              console.log(&quot;Error Message:&quot;)
              console.log(err.message)
          })
          .logMe();
          console.log(&quot;Success!&quot;);
      }
      &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p><strong>Issue</strong></p>
  <p>I can't even get the HTML code to call a simple log function server side! I am expecting a log (somewhere) to read <code>I am a log!</code> but this doesn't show up on the logs either client or server side.</p>
  <p>The logs show that the failure handler is being called with the message: &quot;We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED.&quot;</p>
  <p><a href="https://i.stack.imgur.com/byBPP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/byBPP.png" alt="enter image description here" /></a></p>
  <p>It's weird because I have been able to get an HTML Service side script to call the server before in a separate project with a pop-up window, and am wondering if it's due to:</p>
  <ul>
  <li>the use of the side bar, or</li>
  <li>the way I setup my trigger to create the side bar.</li>
  </ul>
  <p>Any help would be appreciated.</p>