Search code examples
google-app-maker

Previewing failed, but deployment works


Background:

I'm quite new to App Maker, but have been involved in programming/IT for over 2 decades.

I have created an App Maker app, which works fine. It is deployed, and functions internally in our organization.

It accesses a Team Drive spreadsheet, makes modifications to it based on input criteria, and sends an email out to a hardcoded user. It uses no external GCP database or other resource.

The OAuth scopes it requires are:

  • admin.directory.user.readonly
  • drive.readonly
  • script.send_mail
  • spreadsheets
  • userinfo.email

Problem:

I can no longer preview the app.

When I click on "Preview" at the top right, a new tab opens and a spinning wheels seems to indicate that the preview is loading. Within about 4 seconds, the tab closes and the original tab (with the scripts, UI etc) gives a "Previewing failed. Dismiss" error in the bottom centre.

I am both able to deploy the exact same code/UI/etc, as well as run it without issue.

I do not know what I changed, since being able to preview the app, but cannot seem to regress to that state.

What I've tried:

Admittedly not much, as I don't know where to look. I'm rather certain that there must be some setting somewhere, but for all my googling, I've come up empty.

This can't be a client/server script or other syntax issue, as otherwise the deployment also wouldn't work.

With a more meaningful error, I would know where to look.

Expected Result:

Obviously, I should be able to preview the app if it is deployable.


Solution

  • Following @Morfinismo's comment, I contacted G Suite Support; my matter was escalated to the API Team.

    1. I was asked by Google Cloud Support ("Support") to provide network traffic info using FiddlerCap. As I am on a linux machine and FiddlerCap is a windows application, I suggested alternatives (eg:Wireshark). It was eventually not required and never provided.

    2. I noticed that on the Google scripts page, when accessing the project in question selecting "Preview", it was missing the following OAuth: https://www.googleapis.com/auth/admin.directory.user.readonly The functioning deployed version did not have this missing.

    3. Still in the Preview, I selected "Stackdriver (logs)", which gave me an error that the project had been deleted. The actual wording was:

    Access forbidden

    Project XXXX is shut down and scheduled to be deleted. A project owner can cancel the shutdown on the projects list page.

    1. Clicking on the link in the error "Go to projects list page" brought me to a page with the title "Resources pending deletion", which did not load a list of projects (but otherwise fully loaded) and would display the spinning wheel in perpetuity. I attempted this multiple times, including leaving it overnight once.

    2. Support presumed that I had deleted the GCP project, although I honestly don't/didn't think I had. I also confirmed that creating new previews did not work, but creating new deployments did. I also confirm(ed) that this particular App Maker app did not require (eg) a GCP SQL database.

    3. Support pointed me toward the following website: Google undelete project and I was asked to follow these steps (copy-pasted here):

    a. For projectId, enter your project ID. From the screenshot you provided, this is "XXX (redacted)" (the quotes are just to emphasise the project ID, you shouldn't enter them.

    b. Click EXECUTE.

    c. You'll be prompted to grant authorisation, which may be preceded by a prompt to choose your admin account. Please do so.

    d. You should receive a 200 response, with an empty body, that is {}.

    e. Attempt to access the project via Project link (with the actual project id redacted here).

    1. The above yielded some strange behaviour:

    a. undeleteing the project gave it a different name that the App Maker app;

    b. I notice that I had 3 other projects all called correctly (the App Maker app name).

    c. When asked to reauthorize, I was provided with yet another project name ("Untitled project"), which was different from the correct one and different from the one in para. 7a, above.

    d. I then also obtained another error in a new window which read:

    1. That's an error

    Request Details (a bunch of stuff) That's all we know.

    1. Support advised that there may be a propagation issue, and that I should wait up to 30 minutes. I did, and it then worked! The only weird thing was the project name was wrong, but it was only for the preview, so I didn't really care.

    If anyone needs additional information, I can PM screenshots I took along the way.

    Hope this helps someone!

    SJL