0

why is ScriptApp.getService().getUrl() returning another URL while the web app is on another URL? after deploying the web app, the link to it is "https://script.google.com/macros/s/AKfycbyLfBVBICZES9w7N5sYzBYHv8oujoNG1FPnmYxGckZHNWSJh-nDWoFaWw5oZs7Cz3M6QA/exec" but on logger.log when i check the getUrl() it is "https://script.google.com/macros/s/AKfycbwFNB8lsKqyaECOo5Nzdj7SmYB26uXarHZD9WSYTLzmxIDLsoEN/exec"

i have a simple function in this web app to test:

function myFunction() {
 var url = ScriptApp.getService().getUrl();
 Logger.log(url)
}

when i try the link it says "Sorry, unable to open the file at this time.

Please check the address and try again."

what is happening?

*edit: can someone highlight to me what is the purpose of having ScriptApp.getService().getUrl() when it is not doing what it was intended to do?

What i'm trying to do: I cannot have more than 1 html page in the web app or to be specific, i cannot link to another html page within the web app

Unta Laut
  • 1
  • 1
  • Returns the URL of the web app, if it has been deployed; otherwise returns null. If you are running the development mode web app, this returns the development mode url. So the obvious question is what mode are you running in? – Cooper Jul 19 '21 at 14:02
  • okay, as you have said it, it returns the URL of the web app - please tell me this then, why when i execute the returned URL it is not accessible? I've deployed the app at this "https://script.google.com/macros/s/AKfycbyLfBVBICZES9w7N5sYzBYHv8oujoNG1FPnmYxGckZHNWSJh-nDWoFaWw5oZs7Cz3M6QA/exec". In this app i've made a simple function to get value of the URL which is this "https://script.google.com/macros/s/AKfycbwFNB8lsKqyaECOo5Nzdj7SmYB26uXarHZD9WSYTLzmxIDLsoEN/exec". I've made a comparison, they are not the same. – Unta Laut Jul 19 '21 at 16:29

1 Answers1

1

I'm having the same problem. If I work in development mode, ie with the url ending in /dev, ScriptApp.getService().getUrl() returns the wrong URL. However, if you deploy and use the published version link ending in /exec, it will work. I believe this is a bug. As suggested by this post ScriptApp.getService().getUrl() points to dev URL. How can I get it to point to exec production URL?, I have disabled Chrome V8 from running in general settings and it works.

  • okay this is what i get when i published a test web app - "https://script.google.com/macros/s/AKfycbyLfBVBICZES9w7N5sYzBYHv8oujoNG1FPnmYxGckZHNWSJh-nDWoFaWw5oZs7Cz3M6QA/exec" and in this web app i have a simple function to call out the web app url and i get this - "https://script.google.com/macros/s/AKfycbwFNB8lsKqyaECOo5Nzdj7SmYB26uXarHZD9WSYTLzmxIDLsoEN/exec". I've made a comparison, they are not the same even tho it's /exec (means production right?) and best thing is, it's not even executable – Unta Laut Jul 19 '21 at 16:21