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

Failed to find the AppId. #14

Open
ender-null opened this issue Jun 8, 2023 · 7 comments
Open

Failed to find the AppId. #14

ender-null opened this issue Jun 8, 2023 · 7 comments

Comments

@ender-null
Copy link

Got this error, not sure what's the issue

Unhandled exception: MSStore.API.MSStoreException: Failed to find the AppId.
   at MSStore.CLI.Helpers.IStorePackagedAPIExtensions.EnsureAppInitializedAsync(IStorePackagedAPI storePackagedAPI, DevCenterApplication application, FileInfo directoryInfo, IProjectPublisher projectPublisher, CancellationToken ct) in /_/MSStore.CLI/Helpers/IStorePackagedAPIExtensions.cs:line [24](https://github.com/endworks/lovelust/actions/runs/5206050845/jobs/9392187704#step:15:25)0
   at MSStore.CLI.ProjectConfigurators.FileProjectConfigurator.PublishAsync(String pathOrUrl, DevCenterApplication app, DirectoryInfo inputDirectory, IStorePackagedAPI storePackagedAPI, CancellationToken ct) in /_/MSStore.CLI/ProjectConfigurators/FileProjectConfigurator.cs:line 152
   at MSStore.CLI.Commands.PublishCommand.Handler.InvokeAsync(InvocationContext context) in /_/MSStore.CLI/Commands/PublishCommand.cs:line 105
   at System.CommandLine.NamingConventionBinder.CommandHandler.GetExitCodeAsync(Object returnValue, InvocationContext context)
   at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()```
@azchohfi
Copy link
Contributor

It seems like you have not executed the init command for your project. Just run, locally and only once: msstore init. This will list your apps and let you select which app from the store this app is related to. Select the right one, and commit the file changes in your pubspec.yaml and whatever else is changed. This will let the CLI know which app you are trying to publish when the CI runs the publish command.

@ender-null
Copy link
Author

Sorry for the delay in my response. I only receive this error:
💥 Could not retrieve your registered applications. Please try again.

@azchohfi
Copy link
Contributor

Do you get any more details if you run it in verbose mode? Just add "-v" to the failing command.

@ender-null
Copy link
Author

Doesn't make any sense, everything looks good to me.

09:48:51 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down.
09:48:51 info: Microsoft.Hosting.Lifetime[0] Hosting environment: CLI
09:48:51 info: Microsoft.Hosting.Lifetime[0] Content root path: A:\Documents\Projects\lovelust
09:48:51 info: MSStore.CLI.Program[0] Command is init
09:48:51 info: MSStore.API.StoreAPI[0] Getting DevCenter authorization token
09:48:51 info: System.Net.Http.HttpClient.Default.LogicalHandler[100] => HTTP GET https://manage.devcenter.microsoft.com/v1.0/my/applications?skip=0&top=100 Start processing HTTP request GET https://manage.devcenter.microsoft.com/v1.0/my/applications?skip=0&top=100
09:48:51 info: System.Net.Http.HttpClient.Default.ClientHandler[100] => HTTP GET https://manage.devcenter.microsoft.com/v1.0/my/applications?skip=0&top=100 Sending HTTP request GET https://manage.devcenter.microsoft.com/v1.0/my/applications?skip=0&top=100

⣷ Retrieving all registered applications...
                                           09:48:52 info: System.Net.Http.HttpClient.Default.ClientHandler[101] => HTTP GET https://manage.devcenter.microsoft.com/v1.0/my/applications?skip=0&top=100 Received HTTP response headers after 1092.1803ms - 400
⣯ Retrieving all registered applications...efault.LogicalHandler[101] => HTTP GET https://manage.devcenter.microsoft.com/v1.0/my/applications?skip=0&top=100 End processing HTTP request after 1097.6315ms - 400
                                           09:48:52 fail: MSStore.CLI.Commands.InitCommand.Handler[0] Error while retrieving applications. MSStore.API.MSStoreException: Failed to get the applications - {"code":"Unauthorized","message":"A valid account could not be found with given authorization token. CorrelationId=f34b4528-d558-434e-86de-b6c721b25632"}  ---> MSStore.API.MSStoreException: {"code":"Unauthorized","message":"A valid account could not be found with given authorization token. CorrelationId=f34b4528-d558-434e-86de-b6c721b25632"}    at MSStore.API.SubmissionClient.InvokeAsync[T](HttpMethod httpMethod, String relativeUrl, Object requestContent, CancellationToken ct) in /_/MSStore.API/SubmissionClient.cs:line 255    at MSStore.API.Packaged.StorePackagedAPI.GetDevCenterApplicationsAsync(Int32 skip, Int32 top, Cancellation💥 Could not retrieve your registered applications. Please try again.at MSStore.API.Packaged.StorePackagedAPI.GetApplicationsAsync(CancellationToken ct) in /_/MSStore.API/Packaged/StorePackagedAPI.cs:line 120    --- End of inner exception stack trace ---    at MSStore.API.Package
09:48:53 info: Microsoft.Hosting.Lifetime[0] Application is shutting down...

@azchohfi
Copy link
Contributor

It seems like your credentials are invalid. I would try regenerating them and updating your secrets.

@Juliotati
Copy link

Juliotati commented Mar 30, 2024

@ender-null you might have missed this step where you have to "Add Microsoft Entra application"

Account settings -> User management -> Microsoft Entra application then Add Microsoft Entra application

From there, add the application you created (or the CLI) created from "App registrations" and give it Manager(Windows) role

If you have the setup locally, try running msstore apps list.
It should Retrieve Managed Applications

Screenshot 2024-03-30 at 13 34 02

Page link

@Juliotati
Copy link

Juliotati commented Mar 30, 2024

make sure to included the --appId flag

msstore publish --appId ${{ secrets.MY_APP_ID }} -v

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

No branches or pull requests

3 participants