Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spo app add does not return App Id only anymore #11

Closed
Laul0 opened this issue Jan 14, 2021 · 6 comments
Closed

spo app add does not return App Id only anymore #11

Laul0 opened this issue Jan 14, 2021 · 6 comments

Comments

@Laul0
Copy link

Laul0 commented Jan 14, 2021

This is a related issue with pnp/cli-microsoft365#2080

Maybe include the solution that consist to replace UniqueId string from the returned result of the spo app add command.

@waldekmastykarz
Copy link
Member

Thanks for reporting the issue. Let's resolve the issue with CLI first and based on that handle this issue, ok?

@waldekmastykarz
Copy link
Member

We'll fix it in the CLI

@FredrikEkstroem
Copy link

Hi, was this fixed or will it be fixed in CLI? I currently added a local copy and added
JSON.parse(appId).UniqueId to get it to work

@milanholemans
Copy link
Contributor

Hi, was this fixed or will it be fixed in CLI? I currently added a local copy and added JSON.parse(appId).UniqueId to get it to work

Hi @FredrikEkstroem

The default behavior of the CLI is to always return the entire result we get from the API. So if you want to retrieve the UniqueId, you should read this property from the result object.
image

Another way, if you really want the UniqueId only is to use --output text mode. This will return the ID only.
image

Does this answer your question?

@FredrikEkstroem
Copy link

@milanholemans so I guess there are 2 ways to fix this Github Action, to me it looks like it's currently broken?

https://github.com/pnp/action-cli-deploy/blob/master/src/main.ts

should be updated to

//row 27
appId = await executeCLIMicrosoft365Command(`spo app add -p ${appFilePath} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${overwrite} --output text`, true);

//row 31
appId = await executeCLIMicrosoft365Command(`spo app add -p ${appFilePath} ${overwrite} --output text`, true);

alternatively

//row 28
await executeCLIMicrosoft365Command(`spo app deploy --id ${JSON.parse(appId).UniqueId} --scope sitecollection --appCatalogUrl ${siteCollectionUrl} ${skipFeatureDeployment}`);

//row 32
await executeCLIMicrosoft365Command(`spo app deploy --id ${JSON.parse(appId).UniqueId} ${skipFeatureDeployment}`);

@milanholemans
Copy link
Contributor

Hi @FredrikEkstroem you can completely ignore my last comment. I thought I was replying to an issue in the regular CLI repo (my bad).

You are right, this seems like a bug, let's create an issue for this (#18).
Thank you for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants