prom3theu5 / aspirational-manifests

Handle deployments of .NET Aspire AppHost Projects
MIT License
702 stars 36 forks source link

Cannot generate `compose` manifest #262

Open ranma42 opened 1 month ago

ranma42 commented 1 month ago

🔥 Bug Description

I was trying to convert the https://github.com/dotnet/eShopSupport demo to compose format, but aspirate errored out with:

Error executing action 'SubstituteValuesAspireManifestAction':
System.NullReferenceException: Object reference not set to an instance of an object.
  at string Aspirate.Processors.Transformation.Bindings.BindingProcessor.ParseBinding(string resourceName, string bindingName, string bindingProperty, JsonNode
     rootNode) in /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Bindings/BindingProcessor.cs:27
  at string Aspirate.Processors.Transformation.Bindings.BindingProcessor.HandleBindingReplacement(JsonNode rootNode, IReadOnlyList<string> pathParts, string input,
     string jsonPath) in /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Bindings/BindingProcessor.cs:16
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.ReplaceWithResolvedExpression(JsonNode rootNode, JsonNode jsonValue) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:116
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.HandleJsonValue(JsonNode rootNode, JsonNode jsonValue) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:85
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.ResolveJsonExpressionsRecursive(JsonNode jsonNode, JsonNode rootNode) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:51
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.HandleJsonObject(JsonNode rootNode, JsonObject jsonObject) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:66
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.ResolveJsonExpressionsRecursive(JsonNode jsonNode, JsonNode rootNode) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:45
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.HandleJsonObject(JsonNode rootNode, JsonObject jsonObject) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:70
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.ResolveJsonExpressionsRecursive(JsonNode jsonNode, JsonNode rootNode) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:45
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.HandleJsonObject(JsonNode rootNode, JsonObject jsonObject) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:70
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.ResolveJsonExpressionsRecursive(JsonNode jsonNode, JsonNode rootNode) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:45
  at void Aspirate.Processors.Transformation.Json.JsonExpressionProcessor.ResolveJsonExpressions(JsonNode jsonNode, JsonNode rootNode) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/Json/JsonExpressionProcessor.cs:12
  at void Aspirate.Processors.Transformation.ResourceExpressionProcessor.ProcessEvaluations(Dictionary<string, Resource> resources) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/ResourceExpressionProcessor.cs:18
  at Task<bool> Aspirate.Commands.Actions.Manifests.SubstituteValuesAspireManifestAction.ExecuteAsync() in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Commands/Actions/Manifests/SubstituteValuesAspireManifestAction.cs:9
  at async Task<int> Aspirate.Commands.Actions.ActionExecutor.ExecuteCommandsAsync() in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Commands/Actions/ActionExecutor.cs:65

🔍 Steps to Reproduce the Bug

  1. Clone https://github.com/dotnet/eShopSupport
  2. Build it and check that it works as intended
  3. Go to src/AppHost
  4. aspirate generate --skip-build --output-format compose
  5. See error

🧯 Possible Solution