3

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

Marios
  • 26,333
  • 8
  • 32
  • 52
Amit Agarwal
  • 10,910
  • 1
  • 32
  • 43
  • Is it consistently reproducible in a new project? – TheMaster Jul 07 '20 at 08:04
  • 1
    Looks like there are some issues with google service today. whats your location? – mhndlsz Jul 07 '20 at 11:22
  • It is working for me. Do you still experience it? – Jescanellas Jul 07 '20 at 12:51
  • I am experiencing the same issue. I am in California Bay Area and also posted about this today. https://stackoverflow.com/questions/62778017/google-apps-script-dogete-createhtmloutput-returning-broken-google-drive-error. I've also tried to raise a bug: https://github.com/gsuitedevs/apps-script-samples/issues/157 – policenauts Jul 07 '20 at 18:06
  • Per @cameron roberts there is a open bug: issuetracker.google.com/issues/160665120 – policenauts Jul 07 '20 at 22:06

2 Answers2

1

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");
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
  • Can switch from using the "HtmlService" to the "ContentService" for those scripts meant to return just strings ( non html ) ie. APIs..... The problem seems to be when using the "HtmlService" – Arran Pritchard Jul 07 '20 at 21:58
  • Google has fixed the issue at their end. Thanks for the help! – Amit Agarwal Jul 08 '20 at 12:25
1

Thank you for looking into this issue.

It looks like a problem at Google's end and they have acknowledged the bug as well. We'll have to wait until they issue fix.

Update: Looks like Google has rolled out an update and the issue is automatically resolved. The web app is now working as before.

Amit Agarwal
  • 10,910
  • 1
  • 32
  • 43