Google Drive Page Not Found - Sorry, unable to open the file at this time
Asked Answered
E

7

41

I'm using google scripts to deploy a web app. I've done about 5-10 in the same account. When I try and run the web app/script, I'm now getting: a "Google Drive: Page not found" in the title and the message

Sorry, unable to open the file at this time. Please check the address and try again.

I published it to run as the owner, but accessible to "Anyone, even anonymous".

I then tried creating a new small project with a doGet() method that returns a small static web page, with the same result.

Code.gs:

function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('Test');
}

Test.html:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    This is a test
  </body>
</html>

I tried publishing the same spreadsheet/code above in my personal account and it works fine. Since I already have some web apps deployed with the account that's having the error, is there a quota on the number of web apps per account?

I tried a different browser, a different account, re-publishing, and logging out and back in. Same error message. The "Test your web app with the latest code" link also fails. I can directly call the doGet() method in the IDE and it works fine, and I see output in the logs.

I don't see anything in the logs for the page not found error, which is what I expect with the page not found - not even getting to code execution, thus no logs.

Engedi answered 31/10, 2017 at 22:6 Comment(4)
I would take a look at this - hopefully you can find out what happened to your file(s).Cottager
It's not a missing file, it's a script. I'm trying to run the web app.Engedi
@DouglasRussell Can I get the link of your latest page?Rally
script.google.com/macros/u/0/s/…Engedi
R
83

I think you are logged in with two gmail account: That is why (/u/1,/u/0) may have been appended to script address (may be a bug).

So what you have to do is remove /u/0 or whatever is appended.

ForExample:

https://script.google.com/macros/u/1/s/ffffsdds/exec becomes https://script.google.com/macros/s/ffffsdds/exec

Rally answered 1/11, 2017 at 7:20 Comment(9)
This was exactly it for me as well. I removed the /u/0 and everything is working as expected now. Really glad I found this because other googling was failing me!Gerrard
I am glad that you found it Ben. I haggled with it for one day then suddenly saw /u/0 and realized.Rally
moving the /u/0 didn't work form me but signing out of all other accounts didPent
Are you sure that you removed /u/0 without accidentally deleting some characters. Glad you found an answer anyways. Root cause seems to be same, though :-)Rally
Is there a way to get deploy as webapp to remove the /u/0?Isopod
Thanks! I had to actually copy the URL quickly before it redirected, and edit it from there.Anthesis
When I delete /u/0 it been append in the url and I'm not able to remove itUnicuspid
See this other answer https://mcmap.net/q/386066/-google-drive-page-not-found-sorry-unable-to-open-the-file-at-this-time for a URL that works regardless of how many Google accounts you are logged intoBawdy
I logged out of every account, then it worked.Conditioning
J
13

I have several Gmail accounts open at once and kept having this problem. I found it helped to close the Drive window, log out of the email account related to it, and then log back into the Gmail account and open Drive again.

Jinnyjinrikisha answered 27/4, 2018 at 13:5 Comment(0)
G
10

You need to add your organization domain to the URL, as in https://script.google.com/a/yourdomain.com/macros/s/ffffsdds/exec - note that a/domain.com has been added. If you're not using a custom domain, use a/gmail.com.

It works when you are logged in to multiple accounts and redirects to https://script.google.com/macros/s/ffffsdds/exec when you are not logged-in to the particular domain account.

Background info:

  1. https://script.google.com/macros/u/1/s/ffffsdds/exec - does not work if you are logged-in with multiple accounts

  2. In https://script.google.com/macros/s/ffffsdds/exec - "/u/x" has been removed but if you visit that URL, it will still redirect to https://script.google.com/macros/u/1/s/ffffsdds/exec and (1) problem remains when you are logged into multiple accounts (however it works if you are not).

Galsworthy answered 4/12, 2020 at 8:1 Comment(4)
your final solution helped me very much. Could you explain the /a/yourdomain.com ?Changeling
Many Google accounts are bind to custom domains (product Google Workspace). One person can be logged in with multiple accounts using the same or different domains (including gmail.com). If the script is owned by a custom user account it needs to be accessed with (3) including the custom domain in the URL.Galsworthy
This should be the accepted answer from a developer point of view. This allows the script URL to work regardless of how many Google accounts the end user is logged into.Bawdy
I am struggling with this too - multiple gmail accounts and page not found when I try to test my deployed app with a different one to the account used to develop the web app. I am trying to follow the above solution but cannot. Which domain should be used - the users or the developers, and should "gmail.com" be a constant or an actual email address? I am editing the deployed app in the address/location bar but every time it ignores my edits and corrects back to the "/u/x". Any help?Iglesias
A
3

It looks like it's related to this issue: https://issuetracker.google.com/issues/69270374. Authentication is broken for multiple signed-in accounts.

As Google developers suggests, you should:

  1. Signing out of all accounts and using only 1 account: or
  2. Using an incognito tab to sign in

source (comment 292).

What is sad is that, as they said:

The issue originally reported is due to recent improvements in Sheets' ability to handle multiple logged in accounts.

source (comment 11)

So by improving multiple logged in accounts, they also broke it.

Now the "good" news: we can expect this to be fixed in about 1 year I would say.

Our team plans to begin to work on multi-login support for the new Apps Script IDE and container-bound scripts in Q3 ‘21.

source (comment 292)

Avril answered 30/4, 2021 at 16:41 Comment(0)
E
1

All the above answers are relevant. But for me, the issue was due to lack of space in Google account. I've used all 15GB space provided by Google and then all my Google Forms started showing the above error.

Solutions are:

  1. Buy extra space from Google, it wont cost much. For 100GB, it costs Rs.130/month or Rs.1300/year
  2. Free up your space. Go through the Google Drive and you may find a lot of unwanted files. Delete it and make some free spaces.
Ernaline answered 5/1, 2022 at 6:5 Comment(2)
I've freed up a lot of space, but I'm still encountering the error. About how long after you freed up space did the errors go away? Immediately? Or, did it take some time?Cahier
@rinogo, yes it took some time to reflect the change.Ernaline
C
0

I had this issue where I was NOT logged in on multiple accounts. What ended up being the issue for me was that I was using LockService, and it seemed to have gotten corrupted somewhere.

I added

const lock = LockService.getScriptLock();
lock.releaseLock();

before my doPost function, which logs had shown was failing to execute. That seemed to fix the issue. I could then remove this snippet from my code and it continued to work.

Adding this in case someone else has this issue and doesn't want to spend several days sorting it out.

Cap answered 19/5, 2023 at 20:21 Comment(0)
P
0

There is definitely a relation between this error and user authentication logic. For me the issue wasn't that I was logged into multiple accounts, however what worked for was adding the following to the appsscript.json:

{
  ...
  "webapp": {
    "access": "MYSELF",
    "executeAs": "USER_DEPLOYING"
  }
  ...
}

This should force the project to always be accessible by yourself. After this it worked like a charm!

Prevocalic answered 15/10, 2023 at 14:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.