Reputation: 523
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.
Upvotes: 41
Views: 95734
Reputation: 359
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!
Upvotes: 0
Reputation: 101
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.
Upvotes: 0
Reputation: 639
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:
Upvotes: 1
Reputation: 309
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:
https://script.google.com/macros/u/1/s/ffffsdds/exec
- does not work if you are logged-in with multiple accounts
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).
Upvotes: 10
Reputation: 131
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.
Upvotes: 13
Reputation: 160
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:
- Signing out of all accounts and using only 1 account: or
- Using an incognito tab to sign in
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.
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.
Upvotes: 3
Reputation: 1554
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
Upvotes: 83