Docs add-on 'unable to open file at present'

53 views
Skip to first unread message

Mark Grimshaw-Aagaard

unread,
Sep 14, 2021, 3:50:45 AM9/14/21
to Google Apps Script Community
Hi,

Having published my docs add-on (wikindx) to google in May this year, I haven't looked at it since. Today, I thought I would check that it was all still running and, lo and behold, it's not.

First, I opened a blank google doc, clicked on 'Get add-ons, found my add-on in the marketplace, and clicked on install. I got the notice about permissions, OK-ed that, then I got this page:
Screenshot 2021-09-14 at 09.32.16.png
in a new window. I closed the window and the marketplace pane then presented me with this:
Screenshot 2021-09-14 at 09.42.04.png

WIKINDX appears in the add-ons menu but, clicking on it, I get only a cut down version of my HTML pane without any functionality (basically the title and the help icon (which, clicking on, does display help). [So, something is there.] Nothing in the browser console.

Trying to load the script editor on my original add-on development doc, I get the same 'unable to open the file at present' message as before. In the browser console, I get:
Screenshot 2021-09-14 at 09.47.34.png

Does anyone know what is going on? I'm wondering if google has changed something without informing developers. I should state that, I'm not a regular google developer, so, since May, I have forgotten where to find all sorts of information regarding my script/add-on account.

Regards,

Mark

Mark Grimshaw-Aagaard

unread,
Sep 21, 2021, 12:41:20 AM9/21/21
to Google Apps Script Community
Anyone? A week later, I still have these problems and am completely flummoxed.

Mark

Alan Wells

unread,
Sep 21, 2021, 9:55:04 AM9/21/21
to Google Apps Script Community
I don't know what the problem is, and don't work with Google Docs, but I'll ask some questions.
Do you have an onOpen() function that is automatically doing something like opening a sidebar?
Do you have an script tags that are loading client side code when a sidebar opens?
The error message seems to be related to opening a file and maybe a cross origin error.
Does you code try to open a file?  Do you have a link that is making a request to a different domain?
Are you using any client side JavaScript frameworks?

Mark Grimshaw-Aagaard

unread,
Sep 21, 2021, 11:24:34 AM9/21/21
to Google Apps Script Community
Many thanks for the response Alan,

The first thing to stress is that I have not chnaged anything in the script since having the add-on approved and available for download. I checked the download was installable and then left it for a few months only checking again out of curiosity a week agao. So I believe something has changed on the google side.

In response to your questions:
1. I have:
function onInstall(e) {
onOpen(e);
}

in my main wikindx.gs and this opens a sidebar.
2. I have two script tags in my sidebar code. One that links in:
and another that contains a whole series of client-side javascript functions including initialization code when the sidebar opens.
3. This initialization code does not open any file (other than the google localStorage). If a setting is found in localStorage, it loads some form elements populated with data from an external server according to the URL stored in that setting. Of course, when downloading and installing the add-on in a new google docs document, no setting will be stored and so no external calls will be made. The new user should immediately be prompted to enter their external URL. This prompt is not appearing.
4. I've no idea what a client-side javascript framework is. Sorry . . .

I usually work in Firefox and this is where I note the errors in my first post. Today, I decided to try Chrome and I get a different set of errors to the ones I reported above in Firefox:
1. In Firefox, on both attempting a fresh install and attempting to load the script editor on my development document, I get both times the 'Sorry, unable to open file at present' message and, for the latter, the console error above. Today, in Firefox, attempting to load the add-on from my development document, I now get in the console:
'Uncaught ScriptError: We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED.'

2. On Chrome a fresh install and add-on loading from the development document produces in the browser console:
Uncaught  at doXml (wikindxXml:170)
 at getStyles (wikindxXml:96)
 at styleSelectBox (wikindxStyles:2)
 at initializeWikindx (wikindx:134)

and the latter also produces:

In the 'Uncaught' error, there appears to be something missing after that word.

I have not touched a thing in the code since getting the add-on authorised and released so I am quite mystified.

Regards,

Mark

Mark Grimshaw-Aagaard

unread,
Sep 21, 2021, 11:28:37 AM9/21/21
to Google Apps Script Community
. . . forgot to add, Whereas in Firefox, loading the script editor on my development document, I get the 'Sorry, unable to open the file at present' message, in Chrome I do get the script editor with all of my code.

Alan Wells

unread,
Sep 21, 2021, 12:48:51 PM9/21/21
to Google Apps Script Community
Thanks for the information.  jquery is a client side framework.  Are you using jquery functions?  They begin with a dollar sign.
It often happens that something breaks even when the developer has not made any changes.  So, it is likely that changes happened that are out of your control.  Unfortunately, all you can probably do is try to find a different way of running the code.
Have you tried commenting out your script tags in order to determine if that code is causing the error?
If the error goes away when commenting out your script tags, then you could start commenting out lines or sections of code to find out where the error is coming from.
You'll need to isolate the line that causing the problem.
If the client side code is causing the error, then you could try using google.script.run.serverFunction() to call server side code which would then call your external server, get something back, then send it back to the client side code.  You'll need to use a .withSuccessHandler() method.  Are you familiar with that?

Mark Grimshaw-Aagaard

unread,
Sep 22, 2021, 1:15:26 AM9/22/21
to Google Apps Script Community
Thanks Alan for taking the time to give advice.

I use .withSuccessHandler() already with my client-side code for the sideBar e.g.
async function insertReference() {
document.getElementById("wikindx-search-completed").style.display = "none";
document.getElementById("wikindx-search-working").style.display = "block";
await google.script.run
.withSuccessHandler(insertReferenceResult)
.insertReference(
document.getElementById("wikindx-url").value,
document.getElementById("wikindx-styleSelectBox").value,
document.getElementById("wikindx-refSelectBox").value
);
}
function insertReferenceResult(result) {
document.getElementById("wikindx-search-completed").style.display = "block";
document.getElementById("wikindx-search-working").style.display = "none";
if(!result.xmlResponse) {
displayError(result.message);
return;
}
}

I'll start some commenting out over the next few days to see what pops up.

Mark
Reply all
Reply to author
Forward
0 new messages