Houston...we have a problem...

144 views
Skip to first unread message

Dimu Designs

unread,
Mar 30, 2019, 11:35:33 PM3/30/19
to google-apps-sc...@googlegroups.com
I've been experimenting with creating multiple Web App deployments (via the Deployments dialog accessible from the Deploy from manifest option under the Publish menu in the Apps Script GUI) in an effort to set up distinct deployment environments. The intent is to establish a workflow that is more in line with standard software development practices. 

My setup consists of three deployment environments following the standard nomenclature: development, staging and production

Each deployment has a distinct web url (which includes a unique deployment id). Each environment accesses their own distinct configuration (think property stores with the same keys but different values per environment). 

So far so good.

My application is set up to use Google's PubSub's API and its push model. Basically, that means setting up the web-urls (per environment) as webhook endpoints and using them to subscribe to a PubSub topic to receive notifications in response to an event. PubSub requires that all url endpoints be verified and registered (added as a domain) under the GCP project. 

And therein lies the rub...previously I would use the Deploy As Web App option and follow that up with the Register in Chrome Web Store to verify ownership of the Web App's url for use with PubSub. As far as I know this is the only way to verify a GAS Web App Url (and no, none of the other verification methods listed in the search console will work; not meta tags, not embedded html files, not tag manager, or any of the other methods). My problem is that the Register in Chrome Web Store option only seems to apply to Web Apps deployed via Deploy As Web App, but deployments created via Deploy from manifest don't get that benefit and therefore cannot be verified for use with the PubSub API.

I suspect I'm going to have to create a new feature request for this on google's issue tracker, but in the off-chance someone has a solution in mind I've posted this problem here. 

Jasper Duizendstra

unread,
Mar 31, 2019, 3:21:57 AM3/31/19
to Google Apps Script Community
Does PupSub require an unique url to receive messages? If it can route based on url parameters there can be another solution, we sometimes us the format https://script.google.com/a/macros/duizendstra.com/exec?service=AKfycbzSsl7GEDKfrZMLq54xRKmjvkzemZHgLQ3RoIAnCAaj to execute a web app. 

Dimu Designs

unread,
Mar 31, 2019, 10:58:30 AM3/31/19
to Google Apps Script Community
The problem is not that PubSub requires a unique url but rather that the url needs to verified and its domain registered under the GCP API console. As developers, we can do that for the deployment created via Deploy As Web App since the "Register in Chrome Web Store" option automatically verifies the web url for that particular deployment. 

See screen cap and breakdown below:

deployments.png

































The Head deployment is created whenever a GAS project is created and as developers we cannot modify it.

The web app meta-version deployment is created when Deploy As Web App menu option is selected and the web app is deployed at a new version. When the menu option "Register in Chrome Web Store" is selected from the Publish menu the web url associated with this particular deployment is automatically verified. This allows it to be used as a webhook endpoint for a PubSub subscription configured for push notifications. 

The last 3 remaining deployments (proddev, test) I created using the Deploy from manifest option in the publish menu along with the create button in the above deployments dialog. The issue is that there is no option to verify the web urls associated with these three custom deployments. Without verification I cannot use these web urls with PubSub.

Stéphane Giron

unread,
Apr 1, 2019, 6:02:14 AM4/1/19
to Google Apps Script Community
Hi

I think you are right and you will not be able to verify the url as it wil not go through the Deploy as a web app option.

But what you can do is to embed your web app on a page using iframe.
You create 3 custom url on a domain you own :

You create listing on chrome web store using this custom url, as you own doamin you can validate it.

Then you just have to manage publish in the deployments window and each url will be up to date. Here link to solution for embedding script as iframe : https://issuetracker.google.com/issues/63521070#comment33
In comment 34 how i use it to pass parameter with php also

Stéphane

ChiefChippy2 is awesome

unread,
Apr 1, 2019, 11:07:26 AM4/1/19
to Google Apps Script Community
This might sound stupid ( it already did in my brain ), but what if you verify the iframed URL( n-*****-0lu.googleusercontent.com ).

Dimu Designs

unread,
Apr 3, 2019, 8:41:25 AM4/3/19
to Google Apps Script Community
Came up with a solution!

Since I can't verify Web Urls from any of my custom deployments, I setup the deployment generated by Deploy as Web App to act as a middle man and re-POST/redirect incoming POST requests (generated by pubsub) to one of the custom Web App urls. A bit of a hack but it works! 

Maarten Boekhold

unread,
Apr 22, 2019, 8:43:24 AM4/22/19
to Google Apps Script Community
Hi,


Each environment accesses their own distinct configuration


Would you mind sharing how you did that? Been breaking my head over how to provide different configuration options to my DEV, TEST & PRD deployments...

Maarten
Reply all
Reply to author
Forward
0 new messages