Reputation: 191
My Google Calendar addon is published as deployment id AKfycbwFmqDJdIQDqGIMmujFEzwKZlrBKTPJaIitsHGfmqL72Ehm-YShfk3aJXLcJndQJJCU
as can be seen below:
But when setting the add-on "Settings" URL with createSettingsUrlFunction
and calling the following API:
ScriptApp.getService().getUrl()
The returned URL is different from the deployment ID URL:
https://script.google.com/a/xxx.com/macros/s/AKfycbyy4AAzPl3smU-kdts89HQVaZiUFkFek-TyxwBi0FDsMHALscM/exec
What is this script id AKfycbyy4AAzPl3smU-kdts89HQVaZiUFkFek-TyxwBi0FDsMHALscM
? I don't have any deployment with this ID. With previous deployments, ScriptApp.getService().getUrl()
always returned the same id (script id == deployment id).
Upvotes: 2
Views: 1252
Reputation: 38131
The Script ID and the Deployment ID aren't the same.
The Script ID is unique, no matter if the project is deployed or published as add-on or as web application. By the other hand a single project could have as many Deployment ID as the project is deployed.
There are two type of deployments
AFAIK the header deployment ID might be the same as the script id but on vesioned deployments the deployment ID will not be the same as the Script ID.
One simple solution to ScriptApp.getService().getUrl()
returning the wrong ID on versioned deployments, is actually a workaround:
hardcode the ID to be used instead of using
ScriptApp.getService().getUrl()
.
The solution might be to use projects.deployments.list, if that is not be overkilling for your project as it requires additional authorization scopes.
Resources
Related
Upvotes: 1