How to fix “[Error] ScriptError: Document DocumetID is missing (perhaps it was deleted?)” in Google Script

I’ve created a Google Script APP to help someone export Gmail data to Google SpreadSheet.

It works well when I was testing. But after I publish it as web app, and other users got an error which says

[Error] ScriptError: Document DOCUMENT_ID is missing (perhaps it was deleted?).

And no authorize permission form popups up.  I did not get any useful answer in Google.

After several tests I found I made a stupid mistake.

When publishing the Google Script as web app or other types of APP. There are several options need to take carefully.

Execute the app as:

should set as “User accessing the web app“. (The default value is  Me(myself email)).

With this option, when user first use your app, the authorize permission form will popup and ask user to allow your app access their Google APP.

And no more Document is missing error.

Also don’t forget to chose Anyone in the Who has access to the app option.

 

 

 

How to debug Chrome extension Native Messaging app

 

Here is how to debug native messageing: enable logging.

By adding a flag, it can open Chrome logging window when starting Chrome.

For Windows, you just need to right click on the Chrome icon in your installation folder / shortcut / taskbar —— Properties  —— add this line behind the target string:

[code]–enable-logging –v=1[/code]

A logging window will start with the Chrome. There the native messaging stuff will be print out.