I keep getting this error message when I try to click \"Test web app for your latest code.\" in the Publish dialog box.
But I haven\'t defined any function called do
Every webapp in Google Apps Script must have a main function called doGet() which is the entry point of the app, the function that your app will start with when you type the webapp url.
This is true for every application deployed as a standalone app and called by its url - with a user interface or not.
If you read the documentation you'll see that all the standalone apps examples for HTMLService or UiApp have a doGet function.
Only container embedded ui scripts or scripts that run on triggers are not concerned by this rule.
Knowing that, the error message you get is probably more meaningful isn't it ?
As Serge insas said, you must first implement the function doGet(e) as described in Google's documentation.
However, after you implement it, make sure to save a new version of your project (File > Manage versions... and then save the new version) and then deploy the new version of your web app. Else you will continue to get the "doGet not implemented" error from Google. This is because it is still using the old version of your application, before you implemented doGet.
I received this error because I had defined a doPost()
function in my Google Script but my form was submitting a GET request rather than a POST request.
The solution to this problem was to submit a POST request from the form:
<form action='google-script-here' method='post'>