DaleH
DaleH

Reputation: 51

POST to Google Apps Script web app does use latest version

I have built a web app using Google Apps Script, and a lot of information from here, that writes data to a spreadsheet for me. All of the functionality is in the doPost() function and works fine in testing within the GAS environment.

I built a straight HTML, CSS, and Javascript web application to act as the UI front-end and it POSTs fine to the GAS web app ... until I add code to the latter, that is. Once I do that, I keep getting the old version of the GAS app.

I have updated the version, checked to ensure the key has not changed on me, waited 24 hours ... I am missing something fundamental. The only thing that works is opening a new script project, copying the updated code into it, publishing it, and changing the URL reference in my other code. Then I will see the changes.

Needless to say, this is getting tedious. Any pointers to where the problem lies?

Thanks in advance.

Upvotes: 1

Views: 2024

Answers (2)

Daniel Wren
Daniel Wren

Reputation: 290

There are two versions of the web app, practically speaking. There is the published version as it existed when you published it and the development version, which reflects your code as it currently exists in the editor. You can access your updated code in its current state without re-publishing by clicking on the "Test web app for your latest code" link in Publish > Deploy as web app. This will provide you a link with /dev in it instead of /exec.

Published:  https://script.google.com/macros/s/ABCD1234ABCD1234/exec
Development:  https://script.google.com/a/macros/<domain>/s/ABCD1234ABCD1234/dev

Upvotes: 1

DaleH
DaleH

Reputation: 51

The answer is that I needed to choose File > Manage Version and save a new version. That allowed me to re-publish using the new version number, which contains the updates. Simply re-publishing under the old version number does not do what you might expect.

That now explains the problem I had with another script...

Upvotes: 3

Related Questions