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

Releases created Pre-Config as Code project migration fail to open with 'Cannot create DatabaseProjectReference for non-Database project' #8335

Closed
Clare-Octopus opened this issue Sep 12, 2023 · 2 comments
Assignees
Labels
kind/bug This issue represents a verified problem we are committed to solving

Comments

@Clare-Octopus
Copy link

Clare-Octopus commented Sep 12, 2023

Severity

Blocking any customer from viewing the release page for a release that was created before a project migration to CaC

Version

2023.3.12841, 2023.3.12943

Latest Version

I could reproduce the problem in the latest build

What happened?

If I have a Non-Config as Code (CaC) project that has a few releases associated with it (which deploy fine) and then I migrate the project to CaC the old non-CaC release pages will no longer load with the error:

Cannot create DatabaseProjectReference for non-Database project:

image

image

Reproduction

  1. Create a new project and have a simple 'Run a Script' step with a Write-Host Hello World script to be run.
  2. Create and deploy a release for that project, see it deploys successfully.
  3. Convert that project to Config-As-Code (this should create a new release automatically).
  4. Click on the releases page for that project (if not already on it) and click on the release created before you converted that project to CaC.
  5. See the error message 'Cannot create DatabaseProjectReference for non-Database project'.

Error and Stacktrace

2023-09-12 13:04:24.6073   3196     16  INFO  "HTTP" "GET" to "192.168.0.201""/api/Spaces-1/projects/Projects-1022/releases/0.0.1" "completed" with 200 in 00:00:00.0126190 (12ms) by "octoadmin"
2023-09-12 13:04:24.6073   3196     16  INFO  "HTTP" "GET" to "192.168.0.201""/api/Spaces-1/environments/all" "completed" with 304 in 00:00:00.0063886 (6ms) by "octoadmin"
2023-09-12 13:04:24.6073   3196     16  INFO  "HTTP" "GET" to "192.168.0.201""/api/Spaces-1/projects/Projects-1022/channels" "completed" with 304 in 00:00:00.0061249 (6ms) by "octoadmin"
2023-09-12 13:04:24.6073   3196     16  INFO  "HTTP" "GET" to "192.168.0.201""/api/Spaces-1/releases/Releases-1401/defects" "completed" with 200 in 00:00:00.0078456 (7ms) by "octoadmin"
2023-09-12 13:04:24.6073   3196     16  INFO  "HTTP" "GET" to "192.168.0.201""/api/Spaces-1/deploymentprocesses/deploymentprocess-Projects-1022-s-1-JNF7H" "completed" with 200 in 00:00:00.0081027 (8ms) by "octoadmin"
2023-09-12 13:04:24.6073   3196     16  WARN  Could not locate schema for step with Id null and version "1.3.1"
2023-09-12 13:04:24.6073   3196     16  INFO  TinyTypeConversionStrategyProvider: Loading lookups for 2 types "succeeded" after 003ms.
2023-09-12 13:04:24.6073   3196     16  INFO  Converting TinyTypes on "System.Collections.Generic.List`1[Octopus.Core.Serialization.Ocl.Transformation.Transforms.DeploymentProcessOclTransform+ActionTemplateLookupItem]" for "Projects-1022" with strategy IdToSlug "succeeded" after 003ms.
2023-09-12 13:04:24.6073   3196     16  INFO  Converting TinyTypes on "Octopus.Core.Model.Projects.DeploymentProcess" for "Projects-1022" with strategy SlugToId "succeeded" after 000ms.
2023-09-12 13:04:24.6073   3196     16  INFO  "HTTP" "GET" to "192.168.0.201""/bff/spaces/Spaces-1/useronboarding/cac-bug-test" "completed" with 200 in 00:00:00.0472169 (47ms) by "octoadmin"
2023-09-12 13:04:24.6073   3196     16 ERROR  Unhandled error on request: "Cannot create DatabaseProjectReference for non-Database project"
System.ArgumentException: Cannot create DatabaseProjectReference for non-Database project
   at Octopus.Core.Model.Projects.DatabaseProjectReference..ctor(Project project) in ./source/Octopus.Core/Model/Projects/ProjectReference.cs:line 37
   at Octopus.Core.Model.Projects.ProjectReference.FromProjectPath(Project project, ProjectPath projectPath) in ./source/Octopus.Core/Model/Projects/ProjectReference.cs:line 28
   at Octopus.Server.Web.Handlers.GetReleaseSnapshotTemplateRequestHandler.Handle(GetReleaseSnapshotTemplateRequest request, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Handlers/GetReleaseSnapshotTemplateRequestHandler.cs:line 81
   at Octopus.Core.Infrastructure.Mediator.AutofacMediator.Request[TRequest,TResponse](IRequest`2 request, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/AutofacMediator.cs:line 37
   at Octopus.Core.Infrastructure.Mediator.Decorators.SystemComponentModelValidationDecorator.Request[TRequest,TResponse](IRequest`2 request, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/SystemComponentModelValidationDecorator.cs:line 60
   at Octopus.Core.Infrastructure.Mediator.Decorators.FluentValidationsDecorator.Request[TRequest,TResponse](IRequest`2 request, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/FluentValidationsDecorator.cs:line 78
   at Octopus.Core.Infrastructure.Mediator.Decorators.MessageBusSiphoningDecorator.Request[TRequest,TResponse](IRequest`2 request, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/MessageBusSiphoningDecorator.cs:line 37
   at Octopus.Server.Web.Controllers.DeploymentProcesses.GetReleaseSnapshotTemplateController.GetReleaseSnapshotTemplate(GetReleaseSnapshotTemplateRequest request, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Controllers/DeploymentProcesses/GetReleaseSnapshotTemplateController.cs:line 23
   at lambda_method11361(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Octopus.Server.Web.Middleware.BoundaryTrailerRewriteMiddleware.Invoke(HttpContext context, IAutomationContext automationContext) in ./source/Octopus.Server/Web/Middleware/BoundaryTrailerRewriteMiddleware.cs:line 44
   at Octopus.Server.Web.Infrastructure.Authentication.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult) in ./source/Octopus.Server/Web/Infrastructure/Authentication/AuthorizationMiddlewareResultHandler.cs:line 50
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in ./source/Octopus.Server/Web/UnitOfWorkMiddleware.cs:line 46
   at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in ./source/Octopus.Server/Web/UnitOfWorkMiddleware.cs:line 46
   at Octopus.Server.Web.Middleware.OctopusClientOldVersionWarningMiddleware.InvokeAsync(HttpContext context, IAutomationContext automationContext) in ./source/Octopus.Server/Web/Middleware/OctopusClientOldVersionWarningMiddleware.cs:line 51
   at Octopus.Server.Web.Middleware.DynamicContentHeadersMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/DynamicContentHeadersMiddleware.cs:line 50
   at Octopus.Server.Web.Middleware.MaintenanceModeMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/MaintenanceModeMiddleware.cs:line 59
   at Octopus.Server.Web.Middleware.OctopusAuthenticationMiddleware.InvokeAsync(HttpContext context, IUserAuthenticator userAuthenticator, IAuthCookieService authCookieService, IWebAuthCache authCache, ILogger logger) in ./source/Octopus.Server/Web/Middleware/OctopusAuthenticationMiddleware.cs:line 59
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Octopus.Server.Web.Middleware.LegacyRequestLoggerMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/LegacyRequestLoggerMiddleware.cs:line 44
   at Octopus.Server.Web.Middleware.TelemetryMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/TelemetryMiddleware.cs:line 65
   at Octopus.Server.Web.Middleware.ErrorHandlingMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/ErrorHandlingMiddleware.cs:line 50
2023-09-12 13:04:24.6073   3196     16  INFO  "HTTP" "GET" to "192.168.0.201""/api/Spaces-1/deploymentprocesses/deploymentprocess-Projects-1022-s-1-JNF7H/template" "completed" with 400 in 00:00:00.0133893 (13ms) by "octoadmin"
System.ArgumentException: Cannot create DatabaseProjectReference for non-Database project
   at Octopus.Core.Model.Projects.DatabaseProjectReference..ctor(Project project) in ./source/Octopus.Core/Model/Projects/ProjectReference.cs:line 37
   at Octopus.Core.Model.Projects.ProjectReference.FromProjectPath(Project project, ProjectPath projectPath) in ./source/Octopus.Core/Model/Projects/ProjectReference.cs:line 28
   at Octopus.Server.Web.Handlers.GetReleaseSnapshotTemplateRequestHandler.Handle(GetReleaseSnapshotTemplateRequest request, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Handlers/GetReleaseSnapshotTemplateRequestHandler.cs:line 81
   at Octopus.Core.Infrastructure.Mediator.AutofacMediator.Request[TRequest,TResponse](IRequest`2 request, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/AutofacMediator.cs:line 37
   at Octopus.Core.Infrastructure.Mediator.Decorators.SystemComponentModelValidationDecorator.Request[TRequest,TResponse](IRequest`2 request, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/SystemComponentModelValidationDecorator.cs:line 60
   at Octopus.Core.Infrastructure.Mediator.Decorators.FluentValidationsDecorator.Request[TRequest,TResponse](IRequest`2 request, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/FluentValidationsDecorator.cs:line 78
   at Octopus.Core.Infrastructure.Mediator.Decorators.MessageBusSiphoningDecorator.Request[TRequest,TResponse](IRequest`2 request, CancellationToken cancellationToken) in ./source/Octopus.Core/Infrastructure/Mediator/Decorators/MessageBusSiphoningDecorator.cs:line 37
   at Octopus.Server.Web.Controllers.DeploymentProcesses.GetReleaseSnapshotTemplateController.GetReleaseSnapshotTemplate(GetReleaseSnapshotTemplateRequest request, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Controllers/DeploymentProcesses/GetReleaseSnapshotTemplateController.cs:line 23
   at lambda_method11361(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Octopus.Server.Web.Middleware.BoundaryTrailerRewriteMiddleware.Invoke(HttpContext context, IAutomationContext automationContext) in ./source/Octopus.Server/Web/Middleware/BoundaryTrailerRewriteMiddleware.cs:line 44
   at Octopus.Server.Web.Infrastructure.Authentication.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult) in ./source/Octopus.Server/Web/Infrastructure/Authentication/AuthorizationMiddlewareResultHandler.cs:line 50
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in ./source/Octopus.Server/Web/UnitOfWorkMiddleware.cs:line 46
   at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in ./source/Octopus.Server/Web/UnitOfWorkMiddleware.cs:line 46
   at Octopus.Server.Web.Middleware.OctopusClientOldVersionWarningMiddleware.InvokeAsync(HttpContext context, IAutomationContext automationContext) in ./source/Octopus.Server/Web/Middleware/OctopusClientOldVersionWarningMiddleware.cs:line 51
   at Octopus.Server.Web.Middleware.DynamicContentHeadersMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/DynamicContentHeadersMiddleware.cs:line 50
   at Octopus.Server.Web.Middleware.MaintenanceModeMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/MaintenanceModeMiddleware.cs:line 59
   at Octopus.Server.Web.Middleware.OctopusAuthenticationMiddleware.InvokeAsync(HttpContext context, IUserAuthenticator userAuthenticator, IAuthCookieService authCookieService, IWebAuthCache authCache, ILogger logger) in ./source/Octopus.Server/Web/Middleware/OctopusAuthenticationMiddleware.cs:line 59
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Octopus.Server.Web.Middleware.LegacyRequestLoggerMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/LegacyRequestLoggerMiddleware.cs:line 44
   at Octopus.Server.Web.Middleware.TelemetryMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/TelemetryMiddleware.cs:line 65
   at Octopus.Server.Web.Middleware.ErrorHandlingMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/ErrorHandlingMiddleware.cs:line 50
2023-09-12 13:04:24.6073   3196     16  INFO  "HTTP" "GET" to "192.168.0.201""/bff/spaces/Spaces-1/projects/cac-bug-test/intents" "completed" with 200 in 00:00:00.0101820 (10ms) by "octoadmin"

More Information

Initial user forum report - https://help.octopus.com/t/deploying-older-releases-pre-configascode-fail/29336/3

Workaround

None we know of so far, if we find any we will update this section. You can still deploy the non-CaC release via the Overview page, if you wanted to deploy the same release to the same environment you can use the Overview page to click on that release and then re-deploy it.

@Clare-Octopus Clare-Octopus added the kind/bug This issue represents a verified problem we are committed to solving label Sep 12, 2023
@borland
Copy link

borland commented Sep 13, 2023

Release Note: Fix an issue where the release details page displayed an error for releases in a Version-controlled project that were created before the VCS conversion.

@Octobob
Copy link
Member

Octobob commented Nov 1, 2023

🎉 The fix for this issue has been released in:

Release stream Release
2023.3 2023.3.13001
2023.4 2023.4.2928
2024.1+ all releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This issue represents a verified problem we are committed to solving
Projects
None yet
Development

No branches or pull requests

3 participants