I have a Google Apps Script Web App embedded in a Google Sheet (meaning, the Web App code is built into a spreadsheet, and a UI in the spreadsheet is triggering the functionality of the Web App with the UrlFetchApp) through a function that looks like the following:
function cBack(strObj) {
var url = ScriptApp.getService().getUrl();
var options = {
'method' : 'post',
'payload' : JSON.parse(strObj)
};
var response = UrlFetchApp.fetch(url, options);
.....
When the function is run with valid data passed in, I get this error:
Request failed for https://docs.google.com returned code 404
The full response appears to be:
<!DOCTYPE html><html lang="en"><head><meta name="description" content="Web word processing, presentations and spreadsheets"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"><link rel="shortcut icon" href="//docs.google.com/favicon.ico"><title>Page Not Found</title><meta name="referrer" content="origin"><link href="//fonts.googleapis.com/css?family=Product+Sans" rel="stylesheet" type="text/css" nonce="caJsSUva3OGNA7SlHa/0Xg"><style nonce="caJsSUva3OGNA7SlHa/0Xg">/* Copyright 2021 Google Inc. All Rights Reserved. */
And the URL that comes through with the url
variable is https://docs.google.com/macros/s/xxxxxxxxxxxxxxxxxxxxxxxxx/exec
I have run this in incognito mode so there is only one account signed in. I have also tried deploying the web app for only my viewing and for anyone to access. All have given me the same results.
Why do I keep getting this error when it is run? This has worked in the past, seems to just be not working in a new deployment of the web app now...