Publishing a Google Docs Add-on: Project Key is not associated with the current project - google-apps-script

I am attempting to publish a simple Google Docs add-on, following these instructions: Publishing an Add-on
However when completing the configuration for Google Apps Marketplace SDK, I enter my script project key (found from file --> project properties) and receive the following error: 'Project Key is not associated with the current project.'
Only instance where I can find someone with the same problem (here) occurred when they created a project on the Google Developers Console instead of going through resources --> Advanced Google Services. This is not the reason for my error, can anyone shred any light onto my problem?
Any help would be gratefully received,
Connor

Kept trying, did not change the way I tried publishing nor the project key I was entering and it worked after so many retries. Wish I could give a more detailed answer...

I was able to fix by combining two successful responses from this post:
use version number, and only the number, e.g. "1" -- Do not use "v1.0" or "Version 1 on Oct 1, 6:10 AM" or your deployment's Description
After completing step 1, delete your entry in field 'Docs Add-On Project Script ID', then re-enter it -- the page seems to not re-evaluate your changes unless you do this; I had tried saving multiple times before doing this with no success using the correct version number and script ID.

For me I need to go Publish->Deploy as API. Select the correct version and then the publish screen worked

I needed to include a correct version number (1,2,3,4; not "v0.1") in addition to the script ID. The error suggested my script ID was wrong, but the error went away when I picked a valid version number.

For me, the Google App Script file needed to be associated with the project.
In the GAS, go to Resources > Cloud Platform Project.
Under Change Project, enter the project number (which can be found on the home page of the Google Cloud Platform Project in the Project info module), and click Set Project.
Confirm the notices (though make sure that is really what you want to do).
Once it has been set, go back to the App Configuration, and re-enter the information (if you are already on that page, refresh).
That's what worked for me, but maybe other developers get that error for other reasons.
Source: https://developers.google.com/apps-script/guides/cloud-platform-projects#switching_to_a_different_standard_gcp_project

Hmm I had issues as well. It didn't work with version 1 in "Docs Add-on script version" but while I tried a bunch of stuff I ended up deploying again and then I incremented version to "2" and then it worked.

I got the same error today, I made it finally work. I will go through the fields I checked.
App Integration [I'm deploying using deployment ID, you can get the ID from AppScript manage deployment]
Choose which workspace you are releasing [In my case Sheets], type the version from AppScript.
Enter all other general Credentials and save.
The above steps worked for me.

Try to use the Google Workspace Add On and enter the App Script Deployment ID. That accepted for me and showed it as a Sheets Add-On

It's different in deploy or test in legacy editor and new editor.
And I'm using legacy editor before
(because some following steps from documents is not work in new editor),
So when I lookup Mange deployment in new editor,
It wasn't exisisted,
And the deployment ID it's not work when I fill out App configuration in Google Workspace Market.
For me I just change to following the Legacy editor's following steps
https://developers.google.com/workspace/marketplace/enable-configure-sdk#legacy-editor_2
and It works.

Looks like it is not possible to change scriptId after a round of review. So you can just update only version. I changed to last number of deployment version like '6' and it is saved.

Related

Google Apps Script - how to view HEAD Deployment ID / link?

I am not sure if this changed recently with the new IDE, but I thought that the deployment ID / URL of one's web app didn't change when one created additional versions. However, at this moment I am confused.
In my process.env, I have a link to my GAS URL which performs a doGet(e). However, when I go to manage deployments in my GAS file, I cannot find the corresponding deployment ID / link anywhere (not under Active nor Archived), yet, the code is working and reflects the latest changes in my script, so I believe it's the head deployment. Is this correct, or am I using some legacy deployment ID or something that's hidden?
Or perhaps asked differently, if I have the /macros/s/{deployment_id}/exec URL, is there a way within my Google account to find the corresponding script file and version / deployment?
Lastly, if the documentation recommends using versioned deployments, does this mean we have to update the GAS URL each time (e.g., if it's a public facing web app)?
Edit: others have encountered this: https://groups.google.com/g/google-apps-script-community/c/qhiqjGabQpI/m/q5i31yydCAAJ
To view the all deployment IDs, including HEAD (aka version 0):
Switch to Legacy Editor
Go to Publish => Deploy From Manifest
You'll get a list of deployment, with ID next to each one
Copy the ID of Version 0
Paste the ID in the corresponding Google Cloud Console => Configuration
Switch again to New Editor :)
If you are using Clasp with Apps Script for the development simply you can use clasp commands agents the given App Script Project.
clasp deployments to see the list of deployments including HEAD
this document maybe can help you.
Follow step 5 and step 6 in the IMPORTANT POINT.
5. Update the deployment as follows:
a. Open "New deployment" dialog with "Deploy" -> "Manage deployments".
b. For the 1st deployment, click the pencil icon for editing the deployment.
c. Set "version" as "New version".
d. When you want to change the description, please modify it.
e.Click "Deploy" button.
6.Testing
Please use above sample curl command. By this, you can confirm that sample2 is returned without changing the endpoint.
Answer:
There ways of viewing and editing deployments is set out in this article, which I will go through below. If you can not view the desired deployment using these methods, then I would urge you to contact Google Workspace support.
More Information:
As per the documentation on creating and managing deployments:
There are two types of deployments:
Head deployments, which are always synced to the current project code.
Versioned deployments, which are connected to a specific project version.
View versioned deployments
New editor:
To view the deployments of an Apps Script project, at the top, click Deploy > Manage deployments.
Find a deployment ID
New editor:
Open the Apps Script project.
At the top right, click Deploy > Manage deployments.
The deployment ID appears on the current deployment.
References:
Create and manage deployments | Apps Script | Google Developers

G Suite Marketplace: At least one extension must be enabled and selected extensions must be configured

I have published an external Google Spreadsheets addon, and everything worked so far. Since a couple of days, within the "Google Cloud Platform > APIs & Services > G Suite Marketplace SDK > Configuration panel" the input field for "Sheets add-on script version" is empty and an error message "At least one extension must be enabled and selected extensions must be configured" is displayed.
I have already tried the following steps:
Insert the current published script version number and click "Save changes"
Insert a new script version number and click number and click "Save changes"
The response is the following:
Error Sorry, there’s a problem. If you entered information, check it
and try again. Otherwise, the problem might clear up on its own, so
check back later.
Tracking Number: 7178656512110690803
Send feedback
The problem did not clear up so far and also the Google Support team did not reply to my feedback/message so far.
Due to this behaviour I am not able to publish new versions.
It is a new bug. Please star the issue on Issue Tracker for updates.
I work in the G Suite Marketplace. This issue has been fixed and it will roll out to production between today and tomorrow.

Can't switch google cloud project on GAS Editor

I am not able to switch google cloud platform project in GAS editor.
What I am doing is…
Open the google sheet GAS editor
Open Resource --> Cloud Platform Project
Enter project number that I want to connect
With the process above, I was able to switch a cloud platform project but now it returns an error
‘Project does not exist, or you need edit access to it.’
I am using the same cloud project and same account(editor) that I used before and properly worked. I tried do the same with a owner account, but it didn’t work, either.
Also, this cloud project is not a default project nor a hidden project. (If it does, I guess it should not be able to access through GAS editor from the beginning)
I have checked documentation below, but it tells me only case when switching to a hidden project.
https://developers.google.com/apps-script/guides/cloud-platform-projects
Does anyone have a solution or suggestion??
Thank you for the help in advance.
Problem Solved.
I figured out that OAuth IDs which are generated when make connection docs to the cloud project are not be deleted even though delete actual document files.
What I have done is...
Login Google Cloud Platform
Go to APIs&Services --> Credentials
On OAuth 2.0 client IDs, delete unnecessary contents from the list
Back to your docs and switch the cloud project.

Google Cloud Platform: permission denied by accessing Apps Script

I found plenty of questions regarding this issues, but no one answer that could solve my problem.
I have a project in Apps Script, which I deployed as API executable. I enabled Google App Script Execution API. I made OAuth 2.0 Client ID on developer console. I made everything step-by-step as described here: https://developers.google.com/apps-script/guides/rest/api
Then I try to execute code from Google API Explorer: https://developers.google.com/apis-explorer/#p/script/v1/
I fill in request body properly, fill in script id (take it from "File > Project properties" from App Script editor), but what I get is "Permission denied":
Well, I tried to do the same from PyCharm (Python). I fully followed the following instruction: https://developers.google.com/apps-script/guides/rest/quickstart/python
Guess, what I got... The same error!
The Apps Script project is saved in my corporate Google Drive. The scopes of the project are: https://www.google.com/calendar/feeds https://www.googleapis.com/auth/script.external_request , which I filled in correctly in Python and shouldn't fill in in API Explorer.
Many users recommend to check if the project is correctly associated with a project on Google Cloud Platform. When I try to change project, I get error: "The project number should not match." Probably because it is associated correctly...
I almost lost my hope... Again, I saw a lot of answers to this issue across StackExchange forums, but no one could have solved this problem.
One more note: I didn't sign up for the Google Cloud Platform (I don't have a work account there, although it sees my projects and I could have generated OAuth2 2.0 Client ID and API key.
Well, I deleted my python project along with the .credentials file and recreated the project - then it worked. So probably it didn't work, because I missed one of described steps at the first execution of the code and after I fulfilled all the requirements I went on using old creds.
So for all who faces the same problem:
Do everything what is described in the Google documentation and my question.
If you missed something, delete the .credentials file and run the code again. Then it should work.

Google App Script not updating after saving changes and publishing

I came across a weird issue, I created a sample google app script and then published it as a web application. The URL that was published was of -XXXXX format, while I made some changes to the script and re-deployed it as a web app, it did show me the current deployed web app URl, while the 'latest code' showed a URL of YYYYY format. While I do understand that URL-YYYY is my updated google app script, I fail to understand if this is a bug? Or if this is expected (Am I missing something else here)
The "latest code" URL is a developers-only address, with a unique ID followed by /dev. Only the owner of the script can access this, and it will always show the results of the current code.
The published application has a URL with a different unique ID followed by /exec. To show results of updated code, the author must first save a new version, then publish that version.
That is not the problem. There appears to be a bug which does not update the published script. I needed to delete the script completely, save it and add back my saved code. I kept publishing, getting the "exec" version and it never used the new code until I did this.