Solving “Script function not found: doGet”

You’ve written some Google Apps Script code and you are ready to Publish your web app. You click “Deploy as web app…” and navigated to the web app URL only to find…

Script function not found: doGet

This is a simple fix— don’t worry. The problem is that your Google App Script web app code is missing one critical thing: the doGet function.

The doGet Function

The doGet function, like the doPost function,  is what is called a “request handler.” It is the entry point for your web app.

Web apps work by receiving an HTTP GET (or POST) request and executing the code found within the request handler function. The problem is, if you don’t declare a request handler function, you can’t execute any code. That is why returns an error page that says “Script function not found: doGet.”

Common Problems

Web apps can be tricky when you are just starting but the errors generally come from the few typical sources.

// This function never gets called and returns the error, "Script function not found: doGet"
function doNothing() {
  return 'This code never runs...'

// This function causes the error, "The script completed but the returned value is not a supported return type."
function doGet() {
  return 'Plain strings are not a supported return type :('

// This function successfully handles a GET request with safe and supported return type 
function doGet() {
  return ContentService.createTextOutput('I just successfully handled your GET request.');

The same problem can arise if you are sending a POST request but don’t have a POST request handler. Then you will see the error “Script function not found: doPost” error. 

If you see the error “The script completed, but the returned value is not a supported return type.” That means you have handled the request, but you have not returned the right type of safe and supported output. That means it is time to read the following tutorial: Google Apps Script doGet and doPost Tutorial + 6 Web App Examples.

Leave a Comment

Your email address will not be published. Required fields are marked *