Google App Script not working in incognito mode - google-apps-script

i've been learning with google app script, and tried to make a web form because of the limitation of google form. I tried making it by following this example, and it works. However when I tried using incognito or other browser without a google account log on to it, it failed, showing this error
"Maaf, terjadi error pada server saat membaca dari penyimpanan. Kode error INTERNAL."
Which is in Indonesian that basically states the server failed to read the file, and there is an internal error. This is the web app script.
Settings for the web app deployment
Also in the spreadsheet linked is set to anyone with link is able to edit. When this is changed to anyone with link is able to view only, causes a log in prompt to appear in incognito mode.
Any help is greatly appreciated. I also found out earlier that this problem occurred previously because of a bug by google, but it has been resolved. So did I do something wrong?

According to the Apps Script Web Apps documentation:
The first is labeled Current web app URL and ends in /exec. This URL is for the published version of your app, based on the last version you saved and deployed.
The second is the link labeled latest code and ends in /dev. This URL can only be accessed by users who have edit access to the script. This instance of the app always runs the most recently saved code — not necessarily a formal version — and is intended for quick testing during development.
Therefore, when sharing the web application, you should be sharing the /exec link.

There is an open bug for this: https://issuetracker.google.com/issues/160665120

Related

Google Apps Script works in \dev but no in \exec mode

First I have to apologize because English is not my native language and also because I'm just starting in developing. Sorry for all of that.
My question is that when I deploy my app script as a web app the page does not work; but when I used the "Test web app for your latest code" it does work. I don't understand why in the first case (the url finishes with a \exec) appears an error and in the second works nice (the url finishes with a \dev).
The Google Drive error is : The file cannot be opened at this time. Please check the address and try again.
I'm so confused because the web app was working nice, and suddenly it started to show that error, but I did not change anything in the code.
I don´t know if it is related with permissions. I've tried to create new versions but it does not solve it.
Any idea how can I solved it?

Embedded Script (Tasks List API Sample) throws "'Tasks' is not defined" error (works when run in Scripts)

When attempting to embed Google’s sample provided for the Tasks API (code found here) into Google's Classic Sites I get the dreaded “script.google.com refused to connect”. The logging error is "Tasks" is not defined at getTasksLists(simpleTasks:15). Details:
When I embed this same script into Google's New Sites, the UI does show, but the drop-down continues to display “Loading…” (see screenshot below), however if I click on the link provided to view my “Google Tasks” it does go to my Tasks in a new window.
This runs successfully directly from Google Apps Scripts, showing the “Authorization required” pop-up and allowing me to sign in and accept permissions. However, when embedded into both New and Classic sites, it does not request any authorization.
Steps I've taken embedding into Classic Sites (where it needs to be):
from URL provided above: copied code exactly as is into a new Scripts project (nothing altered or added).
from Scripts: deployed it as a Web App, copied the URL provided (the code provided in the link above has not been altered in any way by me)
from Scripts: enabled Tasks API though Resources, Advanced Google Services
from Sites: edit page, Insert Apps Script, pasted URL (i.e. https//script.google.com/macros/s/...5Ym41qn/exec)
Other things I've tried:
from Sites: embedding URL as an iFrame gadget (same results)
solution given here: How to add Google Drive Scripts project into Google Sites? (same results)
days of research into Google's documentation (for Sites, APIs, Scripts, Cloud Platform, you name it)... (various results but nothing productive)
I am very new to working with Sites, Scripts, the Cloud Platform, etc. so apologies if I am missing some obvious steps here. Any guidance would be truly appreciated!
Leora
UPDATE [03-21-19]:
I was able to get this working finally! Although not posting as answer just yet as I haven't figured out the exact change that was brought success.
I thought it was by changing the option within Sites' Publish / Deploy as web app... / Execute the app as: from 'ME' to 'USER' (after doing that it worked), but when I changed it back to make sure that was it, it still worked?
I will play around with it more this weekend and update when I come to a definitive solution.
Thanks to anyone who took the time to help me out here, and if anyone does have any guidance on what's happening here, I'd love to know.

Accessing web app developement URL from UrlFetch service

I'm trying to develop a simple web app using google script web app service and access it from another script using the UrlFetch service.
My problem is that in order to try the code on my web app I have to publish a new version every time because trying to access to the dev URL returns returns and HTML file telling me to sign in even though I've set the permissions for the web app to everyone, including anonymous (if I hit the production URL it does work, though).
I'm assuming that Google is limiting the access to the dev URL for security reasons but can someone shed a light on that assumption?
PS: I don't know if this is relevant but my google account is in a Google Apps for Education domain
Edit
I've found a method to avoid publishing the application for each code change: instead of calling it from the UrlFetch service, I've created a function in the web App code that does call the doPost or the doGet method (I've to create the request param, but that's easy) and I've changed the end of the script to log the result insted of returing it to the client. When the application will be ready, I can publish and develop the client using the UrlFetch.
Anyhow, if anyone knows about the limitation of the dev URL that would be great!
your assumption is correct, the dev url ignores your publishing permissions on purpose, only the developer has access to that url.
you could accomplish what you want using libraries. move the code in your called script to a library and add it to that script as "development mode" and publish your script service.
changing library code should also change your service because its on development mode.
Note that this can easily break your app if you save partial code changes, and makes it hard to test your changed code unless you make all changes and tests in a separate script copy. Making several changes at once in multiple apps script editor files is possible with their "Save all" File menu command (after manually pasting all code changes from your tested copy).

Unmatched app urls when trying to publish to Chrome Store

I'm getting the following error when I try to publish:
This hosted web app has one or more app urls not owned by the developer.
The web_url of this hosted web app is not owned by the developer.
I am getting the green warning box as described in:
https://code.google.com/p/google-apps-script-issues/issues/detail?id=1520
However, I'm hitting the refresh button and no joy in the solving the problem. I've published a lot of apps scripts in the past and never had this issue.
You have to register your url with the Google webmaster tools program and they will give you code to fix this. In case you have already done that, just go and verify again. It happened to me as well and I had to verify the site again. It works!

Open spreadsheet fails in Time Book Application tutorial

This is based on the "Time Booking Application" tutorial.
I have created the site and the spreadsheet and the script in the site.
The site page I created fails to open the spreedsheet.
From the script editor in the site I can run the test methods testGetSheet(), testUpdateSheet() and testInsertTimeSheet(). I believe this indicates the SPREADSHEET_ID is correct. However the site page I created for this errors with "Sorry, the page (or document) you have requested does not exist."
I have tried to share the spreadsheet to be available to anyone with the link and edit ability.
I have tried to share the spreadsheet to public and edit ability.
I have tried this from a seperate unauthenticated browser and from an authenticated browser.
I still get the error.
I have run out of ideas, has anyone else an idea ?
I can provide the url to the page on site, but I doubt its of any use.
Yes answering my own question.
After much research and experiments.
The problem is with access to the script the tutorial does not say anything about permissions or anything.
Anyway solution is. Publish script as Web App use the URL to web app in the App Script Gadget. I have posted this feedback on the tutorial documenation allready.