Can't solve Google File Picker ScriptError on server - google-apps-script

I was following this step-by-step about File Dialogs from Google developers Apps Script pages to insert a Google file picker dialog window into my add-on but I keep facing the same error:
ScriptError: Exception: We're sorry, a server error occurred. Please wait a bit and try again.
I have triple-checked all the steps, key, credentials, scopes in the manifest, and so on and the issue persists. I even looked into this video for some light. No need to say I waited "a bit" and tried countless times. What else might be causing this problem?

I had a similar issue with the file picker and also used the guide on the google homepage.
Try to call "DriveApp.getFileById(). If that results in the same error message, the method below should work.
There seems to be a bug within Google Apps script. You have to enable "Google Drive API" in your Google Cloud Platform Project. Then start the File Picker. Afterwards you may disable "Google Drive API" again.
For more information see StackOverflow, that's where I found the method.

Related

How can I bypass "Sign in with Google temporarily disabled for this app" in a Google Sheets script?

I'm attempting to use a script in a google sheet I've used in the past, and suddenly while trying to make a new sheet with this code, I'm getting a new error that is seemingly impossible to bypass.
"Sign in with Google temporarily disabled for this app
This app has not been verified yet by Google in order to use Google Sign In."
Normally, or at least every time I have used this script in the past, there has been an "advanced" and "continue anyway" option.
"This app isn't verified yet
"Advanced > Continue to Untitled Project (Unsafe)"
This is the code.gs script [gitlab link], how can I bypass this saftey check, and continue using this script as needed?
And for reference, these are the instructions for the whole project on git lab,
Unfortunately, there's no direct solution for the issue you are encountering.
According to the issue from Issue Tracker, the error you are encountering may be due to this cause:
an external user runs the script with sensitive scopes
A possible solution:
run the script from Incognito Mode and remove the project's permissions from myaccount.google.com/permissions
Ultimately, if this still doesn't solve your issue you can star the issue on Issue Tracker here.

No Such User when trying to access google apps script editor

In my Google spreadsheet, when I go to "Tools->Script Editor..", I get a page saying "No Such User" Error. Any idea how to fix this?
I figure this could be a permissions issue, but not sure how to change permissions if required.
Finally i found the solution accidentally.
The issue is resolved by enabling GoogleAppsScript as part of your drive.
Open Google Drive in your web browser.
Click New > More > + Connect more Apps
and then select GoogleAppsScript.
Once i did this going back to script editor of my spreadsheet, no more gives any error.
Here is the link which contained this step:-
https://developers.google.com/drive/v2/web/quickstart/apps-script
Also there is additional problem about Invalid OAuth Client when trying to run the script. which i faced since each apps script has to be attached to a Google Cloud Project. This is accessible only to the person who originally created the file even after its in the team drive. In which case, you need to make a copy of the apps script available by going into File->Make a copy. And then in the Resources drop down , you will see Cloud Platform Project, upon clicking it you can now give the project number of the Google Cloud Platform project you created on console.cloud.google.com.

Google Drive File Picker random sign-in error

Occasionally (sporadically) when the Google Drive file picker is triggered in our app by a properly authenticated user, the picker fails with a message that they need to sign-in to Google (note old Google logo) - clicking this message's Google sign-in button gives the error message API Developer key is invalid.
We removed the API Developer key from the picker call and now the error message after sign-in reads- Details:
The feature you requested is currently unavailable. Please try again later.
Usually the picker works after refreshing the page.
Is this a known bug for the Google Drive picker or is there a workaround?
Google Drive Picker Sign-in error
Google Drive Picker developer key error message
We ended up writing our own drive picker and not using Google's picker at all.
First make sure you use Browser key not Server key and try to verify if you follow the steps here in Register your Project. It will give you step by step procedure on how to use API key with your project. It also have code example for you to follow.
I also see this SO question related to your problem. Solutions here is to add .setCallback(pickerCallback) to createPicker function and add new function (pickerCallback). I hope it can help you.

Publish a Spreadsheet Add-on in the Chrome Store

I'm trying to publish a Spreadsheet Add-on following the the app scripts documentation but I get this error:
Please fix the following errors:
API Console project with the id specified in the manifest's api_console_project_id field, does not have Google Apps Marketplace
SDK enabled. api_console_project_id
Here you can see a screenshot: http://i.stack.imgur.com/s3w3h.png
Inside the documentation it says:
Do not upload a file in the Upload section at the top of the page;
Apps Script generates this file automatically for you and uploading a
separate file will cause the publication to fail.
As far as I know, the api_console_project_id is inside the manifest.json but it says that I should not upload anything, right? (developers.google.com/apps-marketplace/listing#the_manifest_file)
Does anyone know what do I have to do or why I can not publish?
Thanks!
Sorry I didn't saw your comment till now Mogsdad!
Here is the solution
I have found the answer to my problem (I swear I was looking for an answer during the whole day). Anyway, what I had to do was described in Publishing Add-ons for Domain-Wide Installation.
This question gave the the clue:
Error while publishing to chrome web store

Using Google Tasks API in Google Apps Script - Access not Configured

I am getting 'Access not configured. Please use Google Developers Console to activate the API for your project' message.
I followed the guidance in the Google Developers Console documentation. I selected the 'Advanced Google Services' submenu under 'Resources' menu. I turned on the Google Tasks API and copied the API key from the Developers Console and pasted it into the 'Advanced Google Services' dialog and clicked OK.
I typed the example code from 'List task list' on the 'Tasks Service' page. The code autocompleted and saved fine. However when I ran the script I got the 'Access not configured' message. I went to the developers console and the Tasks API appears to be OFF. I do not seem to be able to turn it ON. Do I have to have an OAuth2 API key as well?
I apologise for having to ask for help as the documentation is good but I am confused as to what to do now.
Michael
Problem solved.
I re-read the documentation to do with enabling an API. I upgraded my script to use the new authorisation flow and then it created a new project ID in the developers console. I was able to turn on the Tasks API and the script is working.
Sorry for the trouble.
Michael