Skip to content

"AL: Publish full dependency tree for active project" throwing "UserNotAuthenticatedException" for OnPrem when no credentials are cached #8184

@dannoe

Description

@dannoe

1. Describe the bug
I tried to publish the full dependency tree after my cached credentials expired. I tried to publish to a an on-prem docker container. It compiles the projects and then fails with the following error:

[2026-01-13 13:47:30.51] Error: Exception of type 'Microsoft.Dynamics.Nav.Deployment.Authentication.UserNotAuthenticatedException' was thrown.

[2026-01-13 13:47:30.51] Error: Failed to publish: MyApp
[2026-01-13 13:47:30.51] Error: Microsoft.Dynamics.Nav.Deployment.Authentication.UserNotAuthenticatedException: Exception of type 'Microsoft.Dynamics.Nav.Deployment.Authentication.UserNotAuthenticatedException' was thrown.
   at Microsoft.Dynamics.Nav.Deployment.Http.OnPremiseHttpClientFactory.GetCredentials(ConnectionOptions connectionOptions, IEmitLogger logger) in X:\source\Prod\Microsoft.Dynamics.Nav.Deployment\Http\OnPremiseHttpClientFactory.cs:line 107
   at Microsoft.Dynamics.Nav.Deployment.Http.OnPremiseHttpClientFactory.Create(ConnectionOptions connectionOptions, IEmitLogger logger, Boolean skipRequestLogging, CookieContainer cookieContainer) in X:\source\Prod\Microsoft.Dynamics.Nav.Deployment\Http\OnPremiseHttpClientFactory.cs:line 61
   at Microsoft.Dynamics.Nav.Deployment.ApiClients.AppsApiClient.GetHttpClient() in X:\source\Prod\Microsoft.Dynamics.Nav.Deployment\ApiClients\AppsApiClient.cs:line 191
   at Microsoft.Dynamics.Nav.Deployment.ApiClients.AppsApiClient.SendPackage(Uri uri, String packageFilePath, DependencyPublishingOption publishingOption, CancellationToken cancellationToken) in X:\source\Prod\Microsoft.Dynamics.Nav.Deployment\ApiClients\AppsApiClient.cs:line 89
   at Microsoft.Dynamics.Nav.Deployment.ApiClients.AppsApiClient.PublishPackageFile(String packageFilePath, SchemaUpdateMode schemaUpdateMode, CancellationToken cancellationToken, Boolean isRad, DependencyPublishingOption publishingOption, Boolean forceUpgrade, Boolean disableInstallDebugging) in X:\source\Prod\Microsoft.Dynamics.Nav.Deployment\ApiClients\AppsApiClient.cs:line 78
   at Microsoft.Dynamics.Nav.Deployment.Publishing.Publisher.Publish(PublishOptions options, CancellationToken cancellationToken) in X:\source\Prod\Microsoft.Dynamics.Nav.Deployment\Publishing\Publisher.cs:line 64
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.BuildAndPublishHelper.PublishProjectsAsync(VsCodeWorkspace workspace, IEmitLogger logger, Func`3 publishCallback, IFileSystem fileSystem, List`1 sortedProjects, PooledDictionary`2 outputFileLookup, PublishOptions publishOptions, Solution currentSolution, CustomTelemetryEvent telemetryEvent, CancellationToken cancellationToken) in X:\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\Extensions\BuildAndPublishHelper.cs:line 350

This does only affect on-prem. I could publish the full dependency tree for my cloud sandbox.

2. To Reproduce
Steps to reproduce the behavior:

  • Clear credentials cache (or let it expire)
  • Add an on-prem launch configuration to launch.json or to the workspace file
  • Run the command "AL: Publish full dependency tree for active project"
  • Open the "OUTPUT" view (Ctrl+Shift+U)
  • Wait for the exception

3. Expected behavior
Asking for Username and Password and then publish the full dependency tree

4. Actual behavior
Not asking for username/password and throwing an error after compiling the projects.

5. Versions:

  • AL Language: Version: 17.0.1998613
  • Visual Studio Code: 1.108.0
  • Business Central: BC25
  • Operating System: Windows

** 6. Workaround **

  • First use "AL: Publish with debugging" or any other Publish/Debug command except the full dependency thingy.
  • Enter your credentials
  • Run "AL: Publish full dependency tree ..."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions