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

[Issue] app crash when container app language is not specified #2935

Open
1 task done
sinedied opened this issue Nov 6, 2023 · 2 comments
Open
1 task done

[Issue] app crash when container app language is not specified #2935

sinedied opened this issue Nov 6, 2023 · 2 comments
Labels
aca Azure Container Apps error handling
Milestone

Comments

@sinedied
Copy link
Member

sinedied commented Nov 6, 2023

Output from azd version
Run azd version and copy and paste the output here:
azd version 1.4.3 (commit d165bd2)

Describe the bug
When deploying a container app, azd provision or azd up crashes if the language property is not set. This property should be irrelevant in the case of building a Docker image.

Crash log:

azd provision

Provisioning Azure resources (azd provision)
Provisioning Azure resources can take some time.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x1014b792c]

goroutine 1 [running]:
github.com/azure/azure-dev/cli/azd/pkg/project.(*projectManager).Initialize(0x140004f6ab0, {0x101bb1248, 0x140003ca990}, 0x101baac88?)
        /Users/runner/work/1/s/cli/azd/pkg/project/project_manager.go:81 +0x2c
github.com/azure/azure-dev/cli/azd/cmd.(*provisionAction).Run(0x140004f1000, {0x101bb1248, 0x140003ca990})
        /Users/runner/work/1/s/cli/azd/cmd/provision.go:140 +0x1e8
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x101bb1248?, 0x140003ca990?})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:127 +0x258
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*HooksMiddleware).Run(0x140004ffd00, {0x101bb1248?, 0x140003ca870?}, 0x140004ffa40)
        /Users/runner/work/1/s/cli/azd/cmd/middleware/hooks.go:63 +0xec
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x101bb1248, 0x140003ca870})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:125 +0x20c
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*TelemetryMiddleware).Run(0x140004144e8, {0x101bb1248, 0x1400041fc50}, 0x140004ffa40)
        /Users/runner/work/1/s/cli/azd/cmd/middleware/telemetry.go:75 +0x5c0
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x101bb1248, 0x1400041fc50})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:125 +0x20c
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*ExperimentationMiddleware).Run(0x10172e401?, {0x101bb1248, 0x1400041fc50}, 0x140004ffa40)
        /Users/runner/work/1/s/cli/azd/cmd/middleware/experimentation.go:64 +0x338
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x101bb1248, 0x1400041fc50})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:125 +0x20c
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*DebugMiddleware).Run(0x140004f6b70, {0x101bb1248, 0x1400041fc50}, 0x140004ffa40)
        /Users/runner/work/1/s/cli/azd/cmd/middleware/debug.go:48 +0x30c
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x101bb1248, 0x1400041fc50})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:125 +0x20c
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction(0x14000484300, {0x101bb1248, 0x1400041fc50}, 0x101944ee0?, {0x101ba6298?, 0x140004f1000})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:131 +0x1e4
github.com/azure/azure-dev/cli/azd/cmd.(*CobraBuilder).configureActionResolver.func1(0x140003f8f00, {0x10223b780?, 0x0, 0x0})
        /Users/runner/work/1/s/cli/azd/cmd/cobra_builder.go:143 +0x3c0
github.com/spf13/cobra.(*Command).execute(0x140003f8f00, {0x10223b780, 0x0, 0x0})
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856 +0x554
github.com/spf13/cobra.(*Command).ExecuteC(0x140003a7b80)
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x318
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/spf13/cobra.(*Command).ExecuteContext(0x1018b2400?, {0x101bb1210?, 0x10223b780?})
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:895 +0x48
main.main()
        /Users/runner/work/1/s/cli/azd/main.go:61 +0x1b4

To Reproduce
Relevant extract from azure.yaml

  backend:
    project: ./src/backend
    language: ts # if this line is omitted, azd crashes
    host: containerapp

Expected behavior
Language should be optional for containers, and azd should not crash.

Environment
MacOS 14.0

@savannahostrowski
Copy link
Contributor

This is similar to #1645. We don't currently handle a language:none scenario (we probably should though...as the language doesn't matter for ACA hosted apps).

That said, at the very least/in the meantime, we should have better error handling here.

@weikanglim
Copy link
Contributor

IIRC, we used to have a better error message for this since #2066 (language property must be set) but since our internal implementation push to make every component an application lifetime registration, we've somewhat lost visibility into how these conditions should be handled due to the complexity introduced with dependency injection. Not to say that it can't be fixed easily even in our current DI model, but it is certainly harder to spot.

A nil error panic is certainly something we should avoid completely.

@vhvb1989 vhvb1989 added the aca Azure Container Apps label Dec 13, 2023
@rajeshkamal5050 rajeshkamal5050 added this to the Backlog milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aca Azure Container Apps error handling
Projects
None yet
Development

No branches or pull requests

5 participants