Google Sheets File Picker not showing in Page Editor
Context
- Observed on client call with @twschiller and @mthek10
- When clicking "Select" sheet in Page Editor, the Google File Picker was not shown. The select button stays disabled
- No errors in Page Editor console
- No errors on gapi startup in Background Page (gapi initialized message was displayed)
Discussion
- Brittany was experiencing problems with gapi where she had to reload the PixieBrix browser extension for calls to Google Sheets to work (requiring multiple reloads a day): https://pixiebrix.slack.com/archives/C02CN01JXAA/p1659400679658159
Related Code
@BLoe FYI, was getting an error in 1.7.3-beta.1 when using the File Picker in the Extension Console: https://github.com/pixiebrix/pixiebrix-extension/issues/3794#issuecomment-1212520960
Given that the onerror handler isn't producing useful output, what if we notify the user?
For example:
-
onerror={() => gapiFailed = true}(or something more elegant, likeawait initGoogle()) - When trying to use the gapi, check this loading state and show a notification if it results into an error
This notification would:
- give the user at least some feedback
- prompt Brittany to check the console for further information regarding the load error (if it's in the editor, then she'd have to to open its dedicated console, not the page’s console)
This is advised because the browser may decide to stop a request for a few reasons but never tell us why programmatically; the dev tools may show CSP errors, plain connection errors, proxy errors, ad blockers, etc etc. while we get a plain Network Error
gapi initialized message was displayed
This means that the script was loaded and it was initialized successfully. Since gapi.* method calls would throw if the script completely failed, I assume that the user is already probably notified when that happens.
Edit: from the screencast, it looks like it already happens. I don’t think we can get gapi initialized and also have gapi undefined in the same session.
Notion spec for putting the GSheets bricks behind a GAPI loaded wall: https://www.notion.so/pixiebrix/Make-Google-Sheets-work-the-way-users-expect-041e91ede0d04a928d21b7bfe7f3482f?pvs=4#55601efc5d44410ba9f7af3b23f4424c
Release 1.7.30 includes some fixes and telemetry for this issue. Closing this for now, and will re-open if we continue to see issues