Failed to get details of the deployment ID error - google-apps-script

I tried to change the version of my gmail addon before submitting it but I keep getting this error Failed to get details of the deployment ID.
Steps that I've done:
I managed to add a version to the submit form
My submission got rejected
I made some changes to the addon's code
I tried to change the addon's deployment ID to the new version but I got this error instead

This kind of error usually appears in case of a wrong Deployment ID
Common causes are e.g. spaces introduced before or after the Id.
Another possibility is that the Apps Script project is bound, while for a Google Workspace Add-on it needs to be a standalone script.
It is also possible that MarketSpace SDK does not find the script because the owner of the GCP project and the Apps Script file are not the same person.
While the following behavior would result in a different error than yours - for completion sake:
You also need to make sure that the Apps Script is tied to a Standard GCP project - namely the one to which the Add-On belongs, and that it is the only Apps Script project bound to this GCP project

Related

How to link a Project Number to a Script dynamically?

I'm creating forms on demand and i need to be able to set up the triggers. If i do it on the main AppsScript script that is handling the forms creation, i'll hit the 20 triggers max quota pretty soon. So i decided to add a dedicated script to every form (associating with parentID) so i won't hit the quota.
My problem is that when i try to add the triggers i'm getting permission denied since the scripts created for each form are using a default GCP project and it needs to be a standard GCP project due to OAuth.
I can add the project number manually, but that kind of defeats the idea of being able to generate google forms on demand.
I want to be able to link the script created with the standard GCP project that is already configured, but i just can't find anything on Google's documentation, i know its a long shot but i've decided to post here in hopes that someone that had the same problem managed to do so.
As requested on the comments below, the triggers that i'm using are:
onFormSubmit - get the response and send it to my endpoint in the backend server
onOpen - ensures that the editor hasn't removed anything default (this only works when an editor opens the form in edit mode)
This is the project number im referring to.
Thanks

Keep getting "Deployment Id is not associated with current project." when publishing

I'm trying to publish a Gmail Addon. I'm following guide here:
https://developers.google.com/gmail/add-ons/how-tos/publish
but each time I click save in " Apps Marketplace SDK " configuration page I get the error in the title:
"Deployment Id is not associated with current project."
That's nonsense, since the associated project has been created directly with an action triggered from https://script.google.com
I have even tried to manually create a new project, and to associate the script to the new project, operation that succeeded but the save configuration fails at the same point with the same error.
Any idea?
Are you trying to use the HEAD deployment ID? If so then that's the problem.
I had this problem, it turned out the script was not properly linked to the google cloud project. You can find instructions on doing that here
https://tanaikech.github.io/2019/07/05/linking-cloud-platform-project-to-google-apps-script-project/

"Authorization is required to perform that Action" Error on a copy of existing code that works

I'm using Apps Script and the OAuth2 for Apps Script Library to connect to a couple Google advertising platforms. Basically, each account team has a Google sheet that automatically gets their campaign data every morning. I've got a couple of these sheets up and running already, but when I try to set up this most recent sheet I'm getting the "Authorization is required to perform that Action" at the very end of the OAuth process. I'm able to start the OAuth dialogue, select an account to authorize, but then I run into the error.
I authorized the script in the script editor before I ran it, and all of my OAuth credentials are correct. I've even deleted and re-created the scripts. The other sheets running the same scripts are still working fine.
What's going on here? I'd appreciate any ideas, I've set up a couple test sheets to see if I can puzzle it out, and now they're all returning the same error.
Update: Everything works properly when run from a different account, so it's looking like it's a problem with my account, specifically. Is there any way to manually check that an Apps Script project has been authorized correctly on a given account, aside from the prompt when the script is first created?
I ended up fixing it by explicitly setting the Authorization Scopes in the manifest. In case anyone finds this question later, here's the links to the relevant Apps Script guides:
Authorization Scopes:
https://developers.google.com/apps-script/concepts/scopes
List of OAuth 2.0 Scopes:
https://developers.google.com/identity/protocols/googlescopes

Google Apps Script - OAuth Error

I am getting this error when I run a script from Google Apps Script:
The OAuth identity of this script has been deleted or disabled. This may be due to a Terms of Service violation.
I have deleted and recreated the project and it works for a while but then the error re-occurs. I have also checked the bound project but there are no new Terms of Service agreements for me to acknowledge/accept (tried all the proposed solutions to this question).
Is there any way to get more details on what could be causing this issue or any other suggestions?

ScriptDb in Library accessed by WebApp

I created a Google Apps Script project that is published as a WebApp visible for anyone, running as the accessing user.
This WebApp includes a Library project, which has methods to access ScriptDb as following:
function getDb() {
return ScriptDb.getMyDb();
}
function save(props) {
return getDb().save(props);
}
I intend to have one WebApp running per accessing user (using time-based triggers to access Gmail), however I would like to use the ScriptDb to store data independently from the user running the WebApp.
So I thought the chapter Centralizing a Place to Get a Database Instance from the Google Apps Script Documentation applies here, however I am getting the following error when accessing the WebApp:
You do not have access to library MyDBLibrary, used by your script, or it has been deleted.
Am I doing anything wrong? Was ScriptDb not intended to run independently of the user, when being accessed from a WebApp?
Joscha - you have the set up right and I reproduced everything you've reported. The last thing you were missing was to the share the Library project itself to the public.
The way to do that is to
1. Open the Library project in the script editor
2. Go to File -> Share
3. In the "Who has access" section, set it to anyone with the link can View (dont need edit).
Without this, Apps Script will now know its ok to serve the library code to the public. Hope this helps.
You may need to turn on development mode flag to make it work.
Here's what I did.
User A: Created a Master spreadsheet and created an app script and saved it with version 1.0.
User A: Gave access to this sheet to user B so they can use the common app script.
User A: Gave project access key to user B.
4.User B: Created a spreadsheet and added resource library with project key.
User B: Selected version 1.0.
User B: Turned on development mode.
Note: if I follow steps 1 through 5, then I still see the same error saying I don't have permission or the script has been deleted. However, also doing step 6 will resolve the error and allow you to use the shared script.