'Google apps script URL changes and does not open

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?



Solution 1:[1]

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

Solution 2:[2]

Please refer to this Github repo.

After the first deployment, you need to make further deployments on the same version by clicking on "Manage Deployment" and then selecting the version to "New version" enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 GRTsahil