0
votes

I have an issue where other uses of my Google apps script's url is getting changed. Due to this issue they are not able to open the html page.

Original url "https://script.google.com/a/macros/google.com/s/abcxyz-kaskasdb/exec?v=applyleave"

changed url "https://script.google.com/macros/s/abcxyz-kaskasdb/exec?v=applyleave"

I realize "/a" and "/google.com" is getting removed some how.

How can I fix this issue.

Here is my code that is rendered:-

function include(filename)
{

return HtmlService.createHtmlOutputFromFile(filename).getContent();
}

function render(file,argsObject){

var tmp = HtmlService.createTemplateFromFile(file);
  
  if(argsObject){
    var keys = Object.keys(argsObject);
    keys.forEach(function(key){
      tmp[key] = argsObject[key];
    });
  }
 return tmp.evaluate();
}

And here's the code for the server which should accept POST requests:

var Route = {};
Route.path = function (route,callback){

  Route[route] = callback;
  
}

function doGet(e) {
  
  Route.path("applyleave",leaveApply)
  Route.path("leaveroster",leave_Roster)

  
 if (Route[e.parameters.v]){
   return Route[e.parameters.v]();}
  
   else {
     html = HtmlService.createTemplateFromFile('home');

     
     return html.evaluate();
  
   
   }
}

The error received from other side is this :-

enter image description here

Can anyone explain and provide solution?

1

1 Answers

2
votes

There is nothing wrong with the deployment URL getting changed - it is common for Google to perform this redirection.

The issue is can be rather a permission issue. Make sure you deploy the WebApp as "Anyone, even anonymous".

However, currently I am experiencing the same behavior like you due to a multiply reported recent bug:

https://issuetracker.google.com/72798634 https://issuetracker.google.com/165350842 https://issuetracker.google.com/166010550 https://issuetracker.google.com/166320373 https://issuetracker.google.com/167692852 https://issuetracker.google.com/169349069