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 doGet().
My code is only:
function unreadCount() {
var unreadNum = "Messages unread in inbox: " + GmailApp.getInboxUnreadCount();
return unreadNum
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With