Skip to content

[Issue] nil pointer dereference if service has no endpoints #4064

Description

@dab-abittner

Output from azd version
azd version 1.9.4 (commit 60d7a770c73289e303a539babf5965e638843227)

Describe the bug
nil pointer dereference if a service has no endpoints.

2024-07-03T07:17:03.6009494Z Deploying service migrationservice
2024-07-03T07:17:04.9970512Z Deploying service migrationservice (Logging in to registry)
2024-07-03T07:17:06.4286829Z Deploying service migrationservice (Pushing container image)
2024-07-03T07:17:17.0085129Z Deploying service migrationservice (Updating container app)
2024-07-03T07:17:17.0151392Z panic: runtime error: invalid memory address or nil pointer dereference
2024-07-03T07:17:17.0177186Z [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x55e6aed60f8a]
2024-07-03T07:17:17.0177607Z 
2024-07-03T07:17:17.0180145Z goroutine 482 [running]:
2024-07-03T07:17:17.0181536Z github.com/azure/azure-dev/cli/azd/pkg/apphost.ContainerAppManifestTemplateForProject(0xc00049b2e0?, {0xc00049b2e0, 0x10}, {0x1?})
2024-07-03T07:17:17.0187508Z 	/mnt/vss/_work/1/s/cli/azd/pkg/apphost/generate.go:209 +0xa4a
2024-07-03T07:17:17.0188259Z github.com/azure/azure-dev/cli/azd/pkg/project.(*dotnetContainerAppTarget).Deploy.func1(0xc001224990)
2024-07-03T07:17:17.0188944Z 	/mnt/vss/_work/1/s/cli/azd/pkg/project/service_target_dotnet_containerapp.go:203 +0xa6d
2024-07-03T07:17:17.0189359Z github.com/azure/azure-dev/cli/azd/pkg/async.(*TaskWithProgress[...]).Run.func1()
2024-07-03T07:17:17.0189665Z 	/mnt/vss/_work/1/s/cli/azd/pkg/async/task.go:144 +0xfd
2024-07-03T07:17:17.0190075Z created by github.com/azure/azure-dev/cli/azd/pkg/async.(*TaskWithProgress[...]).Run in goroutine 458
2024-07-03T07:17:17.0190376Z 	/mnt/vss/_work/1/s/cli/azd/pkg/async/task.go:140 +0x1c5
2024-07-03T07:17:17.1984872Z �[31;1mNativeCommandExitException: �[0m/home/vsts/work/_temp/cf44a0ec-3e77-4d46-87f4-9ded6f55697b.ps1:7�[0m
2024-07-03T07:17:17.1985858Z �[31;1m�[0m�[36;1mLine |�[0m
2024-07-03T07:17:17.1986669Z �[31;1m�[0m�[36;1m�[36;1m   7 | �[0m �[36;1mazd up --no-prompt�[0m
2024-07-03T07:17:17.1987154Z �[31;1m�[0m�[36;1m�[36;1m�[0m�[36;1m�[0m�[36;1m     | �[31;1m ~~~~~~~~~~~~~~~~~~�[0m
2024-07-03T07:17:17.1987611Z �[31;1m�[0m�[36;1m�[36;1m�[0m�[36;1m�[0m�[36;1m�[31;1m�[31;1m�[36;1m     | �[31;1mProgram "azd" ended with non-zero exit code: 2.�[0m
2024-07-03T07:17:17.3215739Z ##[error]PowerShell exited with code '1'.

To Reproduce

  • Use .NET Aspire.
  • Create a worker project (<Project Sdk="Microsoft.NET.Sdk.Worker">) and add it to the app model
  • Provision the infrastructure & try to deploy the service with azd deploy (doesn't matter if it's azd up or azd provision & azd deploy) -> above exception is thrown
  • If you add an arbitrary endpoint using WithHttpEndpoint(), the issue doesn't occur.

Expected behavior
The service is deployed without issue.

Additional context
The problem doesn't occur with azd version 1.9.3 (commit e1624330dcc7dde440ecc1eda06aac40e68aa0a3)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions