Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

http status code 500 - Google Script App Fails in Incognito Mode

I have a simple Google Script published as a web app with anonymous access. The code is available here and the web app is available here.

code.gs

function doGet() {
  return HtmlService.createHtmlOutputFromFile("index").setTitle("Google Script")
}

index.html

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <p>Hello</p>
  </body>
</html>

The script web app works in normal Chrome mode but returns a 500 error when the page is viewed in the incognito mode of Chrome or Firefox.

The script fails with a 500 error in both V8 and DEPRECATED_ES5 runtime.

See screenshot.

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes it is consistently reproducible in a new project.

I have the same problem... It is related to the HtmlService

The app script was workng for about a year, but yesterday started to return the error "Google Docs encountered an error".

return HtmlService.createHtmlOutput("<p>Hello World</p>");

If I login it works, however the script is meant to return dynamic list as html when people visit my website, hence why it is needed to run as "as anyone, even anonymous".

Partial Workaround:

Some of my scripts are API's returning just strings, the workaround for these is to use ContentService instead of HtmlService.

return ContentService.createTextOutput("Hello World");

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...