title: How to use a google script web app with Node.js
body: <p>I deployed a web app using google apps script and when I try to make requests to it using <code>Node.js</code> I get the following error:</p>
  
  <blockquote>
    <p>Google Drive Page Not Found - Sorry, unable to open the file at this time</p>
  </blockquote>
  
  <p>But everything works fine when I'm sending the requests using <code>Postman</code>.</p>
  
  <p>This is my node.js code:</p>
  
  <pre><code>  const options = {
      'method': 'post',
      'gzip': true,
      'accept': '*/*',
      'content-length': 0,
      'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36',
      'url': 'https://script.google.com/macros/s/script-id/exec'
    }
    request(options, (error, response, body) =&gt; {
      if(response.statusCode == 200) {
        res.sendStatus(200);
      }
      else {
        res.sendStatus(500);
      }
    });
  </code></pre>
  
  <p>This is the content of the google apps script web app:</p>
  
  <pre><code>function doPost(e) {
    return ContentService.createTextOutput(JSON.stringify({success: true}));
  }
  </code></pre>
  
  <p>There are a couple more questions related to this topic, but the solution they provide is to remove <code>/u/#</code> from the URL ... which does not apply in my case.</p>
  
  <p>Could this happen because I'm making requests from a <code>http</code> server to a web app deployed on <code>https</code>? That's the only thing that I'm thinking of...</p>
  
  <hr>
  
  <p><strong>Update:</strong><br>
  I've also tried to send the request from a <code>HTTPS</code> node server and it still doesn't work.<br>
  Making a <code>GET</code> request works fine.</p>