Status Update
Comments
mu...@google.com <mu...@google.com> #3
Hello there,
When following the steps you mentioned, the URL returned in my test environment is the /dev one and not the one you mention. Hence, I am not able to reproduce this behavior.
Would you mind providing more information regarding this and eventually a list of steps in order to investigate this further?
Moreover, did you notice this particular behavior only with this script or it has happened with others as well?
ya...@gong.io <ya...@gong.io> #4
When executing ScriptApp.getService().getUrl()
as a function directly it indeed works as you explained. We also receive the /dev url.
The way we deploy and test our add-on is on Google Calendar. We want to expose the Script URL through createSettingsUrlFunction
for the calendar addon.
Attaching the manifest file and the function we use for the createSettingsUrlFunction
function.
Attaching also a screenshot showing the mismatch between the Deployment ID and the URL generated in Google Calendar.
Attaching a screenshot taken from the script editor - showing the deployed version id.
Bottom line: I would expect the Google Calendar settings link to return the version deployed and not anything else.
Expected URL returned by ScriptApp.getService().getUrl()
:
Actual URL returned by ScriptApp.getService().getUrl()
:
ya...@gong.io <ya...@gong.io> #5
To answer your last question - this happens consistently. I am able to reproduce this on a new project.
mu...@google.com <mu...@google.com> #6
Thank you for all the details provided. However, I am still not able to reproduce the behavior you are mentioning as the URLs are returned correctly and match even after multiple changes and deployments.
Do you have any other information that might be of help?
ya...@gong.io <ya...@gong.io> #7
You have to deploy the script at least once as webapp, and then continue deploying it from manifest.
Once you deploy as webapp - the webapp deployment URL will always be returned and not the URL for the manifest deployment.
Did you try reproducing this on a Calendar addon with the settings URL?
ya...@gong.io <ya...@gong.io> #8
I have recorded a 10 minute video creating a project from scratch and was able to reproduce the issue.
Youtube is now processing the HD version. I will post the link when it's done processing.
ya...@gong.io <ya...@gong.io> #9
Here it is:
Video demonstrating the issue:
Github repo with the code used for the project:
This should be enough information to reproduce our issue :-)
mu...@google.com <mu...@google.com> #10
So essentially, you don't want to deploy the add-on as a web app at all?
If so, why not remove this part from your manifest? Are you still experiencing the same behavior?
"webapp": {
"access": "ANYONE",
"executeAs": "USER_ACCESSING"
},
ya...@gong.io <ya...@gong.io> #11
I don't think I can remove this part as we do want to serve SettingsPage.html
from within the script (rather than hosting it on another server)
We followed this guide:
And indeed it always worked as expected when deployed from the manifest.
I insist that there IS a bug here and would appreciate any sort of escalation on this matter. Right now we cannot fix any bugs on our calendar addon which is being used by thousands of users.
mu...@google.com <mu...@google.com> #12
Thank you for the details provided.
I have forwarded them internally.
Best regards
ya...@gong.io <ya...@gong.io> #13
Thanks!
am...@gmail.com <am...@gmail.com> #14
Also experiencing the same issue on a first web app deployment.
The following code, if executed, produces https://script.google.com/macros/s/AKfycbxB92DN3YhFYwF5dY7qMN8OzDcUlw1d-QtS25DtPI8fnlo4i5CE/exec
instead of the correct https://script.google.com/macros/s/AKfycbztKJrN9rDvWkE5t4wQkQbZrmrb0MGZx1Q4pgTM3w/exec
(as provided by the GUI in manual deployment.
function setWebHook() {
var hook = ScriptApp.getService().getUrl();
Logger.log( hook );
return;
}
These are also different from the dev URL https://script.google.com/macros/s/AKfycbx7FhrfLgItjJUMqaayswl_tTT439BdvbXLZmGEBmaC/dev
az...@gmail.com <az...@gmail.com> #15
On Nov 22, 2020 3:27 PM, <buganizer-system@google.com> wrote:
>
> Replying to this email means your email address will be shared with the
team that works on this product.
az...@gmail.com <az...@gmail.com> #16
Michael Teresa terver
On Nov 22, 2020 3:27 PM, <buganizer-system@google.com> wrote:
wo...@gmail.com <wo...@gmail.com> #17
sz...@ecparamedics.com <sz...@ecparamedics.com> #18
yz...@gmail.com <yz...@gmail.com> #19
I have found a workaround that works for me. Using clasp
, create a new version:
clasp version "new feature"
This will display the new version number in the terminal. Use that number to deploy the new version to the deployment ID being returned by ScriptApp.getService().getUrl()
:
clasp deploy -V <version> -d "new version with old ID" -i <deployment ID>
wo...@gmail.com <wo...@gmail.com> #20
Really strange why google does not solve this issue. It's open since month.
ph...@gmail.com <ph...@gmail.com> #21
i work in the new editor - i will try the old (and redeploy from it, I guess...)
ph...@gmail.com <ph...@gmail.com> #22
I hope that's help...
sf...@truststamp.net <sf...@truststamp.net> #23
ph...@gmail.com <ph...@gmail.com> #24
1) you deploy a new version (let say V 5 with the new editor) --> give you a new_ deploymentID
2) then you pass the command from a clasp environnement, on this version, with the old_ID (the one always returned by the getUrl() )
clasp deploy -V 5 -d "new version with old ID" -i <old_ID>
so, you have two deployement_id for the V5 (and one with the correct behavior !)
I don't understand why this issue is so difficult to fix...
li...@gmail.com <li...@gmail.com> #25
My expectation - based on use of the Legacy Script Editor is :
[1] Project ID is assigned/created at Project creation
[2] Deploying a New version, via the editor, of a project does not change the assigned Project ID (or deployment URL).
[3] Testing a version before public deployment can have any URL assigned to it.
Currently the New Editor is assigning a new URL when instigating a new Deployment (see the ticket for details). This cannot be correct.
Consider the case where some one has bookmarked or is linking to you deployment URL - if the URL is changed for every new version they will never see the new version. Also - if you archive old versions - then their links will be broken.
The assignment of a published deployment URL per project must be a one time - constant throughout the lifetime of the project - deal.
le...@contractors.roche.com <le...@contractors.roche.com> #26
I came here from StackOverflow where I was looking for a solution.
In legacy editor user had to save new project version and then publish it (or do it at once)
There were two links: dev (head) and published version with static link (web app meta-version)
In a new editor, every time project is deployed it gets a new ID and new link but web app meta-version is not updated. There is no way to control this published with the static link version (web app meta-version). So bookmarks and reverences point to the old version or are broken if this version was archived. This is BAD!
ScriptApp.getService().getUrl() seems to always return the same static link to web app meta-version. This what is confusing OP IMHO.
Workaround that worked for me: swith to legacy editor, publish (deploy as web app) the leatest (or required) version. It will became web app meta-version reachable by the same old link. I assume the same returned by ScriptApp.getService().getUrl(). Not sure about dev link.
li...@gmail.com <li...@gmail.com> #27
Agree - only solution is to revert to Legacy Editor and publish New. This is this only way to get new WebApp content up to replace existing version - and therefore respect any URL links or bookmarks users have to the WebApp.
L
[Deleted User] <[Deleted User]> #28
[Deleted User] <[Deleted User]> #29
rr...@rubenrivera.mx <rr...@rubenrivera.mx> #30
Few days ago Google make it possible to create and assign a version for an existing deployment. See
ri...@quill.co.uk <ri...@quill.co.uk> #31
I too am having difficulty with ScriptApp.getService().getUrl()
But my problem is that I am getting different results for different users in the same google workspace
For my user account, it returns what I expect e.g. https://script.google.com/a/macros/{myWorkspaceDomain}/s/{appId}/exec
But for a different user account within our same workspace domain, it returns: https://script.google.com/macros/s/{appId}/exec
<-- note the missing workspace domain!?
Both myself and the other user have Chrome logged into their Google account
My horrible workaround is to run the app in dev mode and hardcode the url, which also means I have to share the actual script code with non-dev users :(
rs...@positivelypartners.org <rs...@positivelypartners.org> #32
Also have this issue and was able to workaround it by switching to legacy editor to deploy/redeploy.
ma...@unipd.it <ma...@unipd.it> #33
po...@mpm.edu <po...@mpm.edu> #34
jd...@gmail.com <jd...@gmail.com> #35
I have a deployed webapp with daily triggers integrated (webapp and triggers are code in the same project).
Both webapp and triggers uses ScriptAtpp.GetService().getUrl()
1. Executing the webapp, the function ScriptAtpp.GetService().getUrl() returns correct url
2. Executing the same function in a daily trigger, it returns a diferent url
mh...@gmail.com <mh...@gmail.com> #36
[Deleted User] <[Deleted User]> #37
Same issue of one of my newly created standalone apps script projects (V8 runtime).
Additionally, I can confirm that deploying a new version of the web app using the Legacy Editor circumvents this bug, as the user nicely suggested in
tv...@gmail.com <tv...@gmail.com> #38
br...@allycounseling.com <br...@allycounseling.com> #39
function getUrl() {
const scriptId = '...vZWVk4TZAhyhV8Q/exec';
const urlStart = "
const url = urlStart + scriptId;
Logger.log(url);
return url;
ri...@quill.co.uk <ri...@quill.co.uk> #40
Every time you have to switch to legacy editor, please provide this issue as the feedback. Perhaps this will prompt some action?
I do like the new editor UI but, like others here, I have to switch back to legacy editor for new deployments for getUrl() to work as expected.
ma...@gmail.com <ma...@gmail.com> #41
jr...@gmail.com <jr...@gmail.com> #42
Wi...@bvpri.org <Wi...@bvpri.org> #43
sh...@ocado.com <sh...@ocado.com> #44
I have hit something similar. In my case, I ONLY deploy my application as a web app but have multiple active deployments and use getUrl()
to try and distinguish between them.
For one of my projects, calling ScriptApp.getService().getUrl()
returns the same URL every time regardless of which deployment it is actually being called from.
The URL that gets returned doesn't match ANY of the active deployments, but it does match the URL shown if you go into the legacy editor and open the dialog via Publish --> Deploy as web app.
I can't reproduce in a fresh project, but I also can't afford to re-create the project from scratch either.
If it's helpful at all, I can provide the URLs in question.
fl...@onesession.fr <fl...@onesession.fr> #45
I need to get this url programmatically, but this method doesn't work for versioned deployments.
lm...@learninglions.org <lm...@learninglions.org> #46
li...@gmail.com <li...@gmail.com> #47
Happens on every WebApp deployment I have. Also get the published URL back from the API call, never the test (/dev) URL.
Makes pre-publish testing a real handful
L
ri...@quill.co.uk <ri...@quill.co.uk> #48
+1 on comments #46 & #47 above
In my case, when running in test mode, getUrl() returns a bogus url that renders a "Sorry, unable to open the file at present." page.
It would make more sense and be much more helpful if getUrl() returned the actual /dev url when running the web app in test mode
mo...@gmail.com <mo...@gmail.com> #49
It's been a year and Google has not taken an action to fix this bug. It happens here in both old and new editor
ge...@gmail.com <ge...@gmail.com> #50
su...@childrenshome.us <su...@childrenshome.us> #51
Here is a simple recreation of the consistent failure of ScriptApp.getService().getUrl() to properly detect dev mode. This is 3 files, and I am accessing the dev link.
DEV URL:
code.gs >>>>>
function doGet(e) {
console.log(e.parameters)
console.log(getAppUrl());
var template = HtmlService.createTemplateFromFile("loading-html");
if(e.parameter.test){
var template = HtmlService.createTemplateFromFile("Test-html");
template.url = getAppUrl();
}
return template.evaluate();
}
function include(fileName){return HtmlService.createHtmlOutputFromFile(fileName).getContent()}
function getAppUrl() {return ScriptApp.getService().getUrl()}
Loading-html.html >>>>>
<!DOCTYPE html>
<html>
<head>
<base target="_self">
</head>
<body>
<div class="container" id="loadingDiv">
<h5>Loading CHP Test</h5>
</div>
<script>
document.addEventListener('DOMContentLoaded', function(){google.script.run.withSuccessHandler(function(appUrl){var link = appUrl + '?test'; window.open(link, '_self')}).getAppUrl()});
</script>
</body>
</html>
Test-html.html >>>>>
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<p>URL: <?!= url ?></p>
</body>
</html>
console #1 >>>
Nov 9, 2021, 9:37:59 AM Debug {}
Nov 9, 2021, 9:37:59 AM Debug
console. #2 >>>
Nov 9, 2021, 9:38:00 AM Debug { test: [ '' ] }
Nov 9, 2021, 9:38:00 AM Debug
This will return the exec url every single time, 100% broken
If that's too much, we can nail it home quicker:
doGet(e){console.log(ScriptApp.getService().getUrl())}
The end. The log will still never show the dev URL.
console >>>
This will prevent proper testing and development of any production web app, and should be a top priority to someone over there. I have easily proven that it essentially renders proper dev testing impossible. When can we expect you to make your service function again? This should be considered a complete failure / stoppage of basic functions, and should be addressed immediately.
su...@childrenshome.us <su...@childrenshome.us> #52
Another issue tracker has marked this as completed as of yesterday:
yu...@pwc.com <yu...@pwc.com> #53
ra...@gmail.com <ra...@gmail.com> #54
still an existing issue
co...@gmail.com <co...@gmail.com> #55
to...@educ.goteborg.se <to...@educ.goteborg.se> #56
Sometimes it was the wrong url and sometimes it was null.
I have every app report its url to a google spreadsheet periodically.
I came up with a workaround using a dummy template file
Main.gs:
function updateTemplateUrl() {
HtmlService.createTemplateFromFile("_url").evaluate();
}
function updateWebAppUrl() {
let url = ScriptApp.getService().getUrl();
...
}
_url.html:
<? updateWebAppUrl() ?>
Then I used updateTemplateUrl as a timed trigger.
[Deleted User] <[Deleted User]> #57
From
on 26/4/2022: issue 230391950
-
Steps to reproduce the problem (including sample code if appropriate -> current APN settings in apns-full-conf.xml) : <apn carrier="Mobitel" carrier_id = "1931" mcc="413" mnc="01" apn="default" type="default,supl" />
-
What happened : As leading mobile service provider in Sri Lanka, we have partnered with SLT, and since most of the above APN settings were outdated, we are hoping to modify our APN settings as below.
-
What you think the correct behavior should be (Requesting to update to bellow settings) : <apn carrier=” SLTMobitel" mcc="413" mnc="01" apn="mobitel" mmsc="
http://mmsc.mobitel.lk:8080 " type="default,supl,mms" protocol="IPV4V6" roaming_protocol="IPV4" />
(4) Version of Android : all version
(5) Device (model and Android version) : all make and model
Thank you,
Jaque Perera
Manager - Digital MediaConsumer Marketing
Mobitel (PVT) Ltd
[Deleted User] <[Deleted User]> #58 Restricted+
du...@gmail.com <du...@gmail.com> #59
So called "google support".
du...@gmail.com <du...@gmail.com> #60
is...@google.com <is...@google.com>
um...@gmail.com <um...@gmail.com> #61
ko...@gmail.com <ko...@gmail.com> #62
da...@pvusd.net <da...@pvusd.net> #63
li...@gmail.com <li...@gmail.com> #64
ago I wanted to share with this group of ticket observers, some
observations and perhaps remedies :
Firstly, let me declare that I no longer suffer from this issue - my
AppsScript WebApp URLs are now behaving consistently.
Observation 1:
Secondly, let me also declare that moving from the old Editor to the new
Editor absolutely *WILL* cause your App (any version) to receive a new
deployment ID and hence deployment URL.
I'm afraid Google did a very poor job at making this fact known to the
community.
Given the timeline of September 2022 to make the switch (no classic editor
afterwards) - make the switch and get comfortable now !
Observation 2:
Once you have switched a project to the new editor - stick with it - *DONT*
switch back to the classic editor. I have had a couple of cases where
deployments (deployment ids) have got very screwed up and the only way I
have been able to clear the confusion is to create a new project, and copy
each AppScript file across manually. The equivalent of pressing the Big
Reset button.
The confusion was definitely caused by switching back and forward between
the two editors.
Observation 3:
Although I haven't tested this recently - in the early days of the new
editor making changes and 'updating' an existing deployed version (no
matter how trivial the change) did not occur reliably.
I spent a lot of time in devtools - checking/clearing caches etc - but it
just looked like my change never actually got deployed.
Instead *ALWAYS* deploy every change as a new deployment version.
Doing this resolved 99% of my issues with URL/Project Ids being messed up.
And to be clear - creating a New Version deployment does *NOT* generate a
new deployment ID - it just creates a new project instance(version) on the
existing project URL.
Observation 4:
To create/deploy a new version of the project - on the New Editor - select
the blue Deploy button and then *Manage Deployments* (*DONT* select New
Deployment from the menu - this will cause and entirely new copy (branch)
of your AppScript project to be deployed and you *WILL* get a new
deployment id and deployment URL)
From the Manage Deployments window select the edit icon (ink pen) and from
the activated dropdown list of project versions select 'New Version' - and
proceed.
Your AppsScript WebApp will deploy using the previous,
pre-existing deployment ID and deployment URL. Success !!
I hope this helps resolve other people's issues. Happy AppsScript Coding
On Tue, 9 Aug 2022 at 03:40, <buganizer-system@google.com> wrote:
su...@perdana.biz <su...@perdana.biz> #65
I am having the same issue ...
wa...@reas.jp <wa...@reas.jp> #66
th...@gmail.com <th...@gmail.com> #67
cb...@gmail.com <cb...@gmail.com> #68
Much thanks!
pe...@childrenshome.us <pe...@childrenshome.us> #69
su...@childrenshome.us <su...@childrenshome.us> #70
Here is a basic test. To be clear, it isn't failing for all of our web apps. At this point, it is just one. However, we are going out of our way not to need to update, with the fear that deploying will break things again. It is working correctly in dev, but fails every time in exec. You can see that the structure of the URL changes as well.
function doGet(e) {
return HtmlService.createTemplate("<html><body><p> The app has returned the URL of: " + ScriptApp.getService().getUrl() + "</p></body></html>").evaluate();
}
Outcome:
The app has returned the URL of:
vn...@veolia.com <vn...@veolia.com> #71
I had some odd things happen, where the "version number" was still reporting the old number for the "Deployment" header when viewing "Executions", versus what would be returned by the "ScriptApp" (e.g., obj.deploymentConfig.versionNumber)... but it must have been a caching issue, the Executions reporting log corrected itself after refreshing the "../executions" page...
[Deleted User] <[Deleted User]> #72
ab...@gmail.com <ab...@gmail.com> #73
and there is no workaorund,
I use the url for navigation.
So everything is screwed up.
Thank Yo Google!
ka...@gmail.com <ka...@gmail.com> #74
ce...@najeebmedia.com <ce...@najeebmedia.com> #75
Hi,
an updates?
for now, I have managed to fix like this:
- create a const
const DEPLOYMENT_ID = 'YOUR-LAST-DEVELOPMENT-ID'
- use this function
function get_webapp_url(){
// getting WebAppURL based on deployment id provided
var user = Session.getEffectiveUser();
var email = user.getEmail();
var domain = email.split("@")[1];
var url = `https://script.google.com/a/${domain}/macros/s/${DEPLOYMENT_ID}/exec`;
return url;
}
Yes, you need to create another deployment after your final deployment to make it work :)
go...@gmail.com <go...@gmail.com> #76
ni...@gong.io <ni...@gong.io> #77
The workaround with
We already had two active deployment IDs:
- For the webapp which is referenced by
ScriptApp.getService().getUrl()
- For the add-on
I created a new version with
clasp version "new feature"
Which returns the #new-version-number.
And then updated both deployments to the same version:
clasp deploy -V #new-version-number -d "new version with old ID" -i <webapp deployment ID>
clasp deploy -V #new-version-number -d "new version with old ID" -i <add-on deployment ID>
ro...@gammanet.pl <ro...@gammanet.pl> #78
we are all still waiting for this, Google Developers....?!
It is really so difficult to fix it?
Waiting more than 2 years...
jp...@google.com <jp...@google.com>
xe...@gmail.com <xe...@gmail.com> #79
[Deleted User] <[Deleted User]> #80
I'm using ScriptApp.getService().getUrl() as the redirect_to for OAuth flow, the project is deployed as both API executable (for calling functions via Clasp run), WebApp (for the doGet() working as OAuth callback) and Editor Addon (primary function).
When the user from the Editor Addon clicks to initiate the flow, the Script URL does not change regardless of the version and deployments, or where I deploy from (
If I use clasp open --deploymentId <the id extracted from the url before the /exec part>, it points me to the correct project
This is a problem because I'm not able to send the users to the correct URL for the authentication flow.
The issue *may* stem from the fact that the script was previously bound to a specific sheet, and only later I created a Google Cloud Platform project for it. I can't find the deployment id that's part of the url returned by ScriptApp.getService().getUrl() in the list of "clasp deployments".
I believe this is a bug but I'm happy to be proven wrong.
Thank you Google Team, looking forward to your reply
Description
According to the documentation, this method should return the URL of the web app:
"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."
We have a Google Calendar add-on in which we have custom settings page (html) delivered to the clients using
HtmlService
and I have no idea howScriptApp.getService().getUrl()
works with versioned deployments.Here's an interesting scenario:
On a fresh Google Script project, we deployed from manifest file (NOT webapp, although we have the "webapp" part on the manifest)
First versioned deployment from manifest:
ScriptApp.getService().getUrl()
correctly returnsVersioned Deployment ID:
AKfycbzR21YpWNakFEisFcW1zo-tArveQ5nXj_gTRYLF4OZWkMf_Gun8Q3I2WZncfLSbjKEr
Made some changes, created a new versioned deployment
ScriptApp.getService().getUrl()
correctly returnsVersioned Deployment ID:
AKfycbxXBdBXAV7olI0NGe-uS0_4FEFZPPNXLVHml6NNNW9zYf1fLOqfLhLYsaz6FTmjduIq
We've deployed the script through Publish->Deploy as web app... Probably done this mistakenly on our production script
Web app URL ishttps://script.google.com/a/gong.io/macros/s/AKfycbzv1gX4eim1CzTjnFc4sFNvLMw9mXCfOv4laDu-_9AKefk5jXg/exec
Another round of code changes to the script. This time we deployed from manifest:
ScriptApp.getService().getUrl()
incorrectly returnsVersioned Deployment ID:
AKfycbx29Pcs8_cpEkodrfWGklz8t_OAs87OBSEtxLMkStrya64wUV4M2ePW_tNTTWlq0_T1
Notice that this time - we got the webapp deployment ID - not the versioned deployment id.
From here on, no matter what I've tried - I will ALWAYS gethttps://script.google.com/a/gong.io/macros/s/AKfycbzv1gX4eim1CzTjnFc4sFNvLMw9mXCfOv4laDu-_9AKefk5jXg/exec no matter what we do.
As of now, everything I do ends up in
ScriptApp.getService().getUrl()
returning this URL.How can I reset it and get
getUrl()
to return the versioned deployment ID rather than a non-existing webapp deployment ID?edit: typos