DefangLabs / defang

Defang CLI and sample projects. Defang is a radically simpler way for developers to develop, deploy, and debug cloud applications.
https://defang.io
MIT License
39 stars 9 forks source link

Edw/fix put config panic #864

Closed edwardrf closed 1 week ago

edwardrf commented 1 week ago

Description

Bug fix for PutConfig api call missing project name. Also verified no other requests with Project field is not set properly from PR https://github.com/DefangLabs/defang/pull/813

Linked Issues

Fixing a panic with set config

$ defang config  set TEST_ARG
 * Using AWS provider from defang server
? Enter value for "TEST_ARG": [? for help] ****
panic: ProjectName not set [recovered]
        panic: ProjectName not set

goroutine 1 [running]:
main.main.func1()
        /defang/src/cmd/cli/main.go:20 +0x145
panic({0x177a3a0?, 0xc0004bf870?})
        /home/edw/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.linux-amd64/src/runtime/panic.go:770 +0x132
github.com/DefangLabs/defang/src/pkg/cli/client/byoc/aws.ensure(...)
        /defang/src/pkg/cli/client/byoc/aws/byoc.go:987
github.com/DefangLabs/defang/src/pkg/cli/client/byoc/aws.(*ByocAws).stackDir(0x0?, {0x0?, 0x0?}, {0x7fff226c1f9e?, 0xc0002978b8?})
        /defang/src/pkg/cli/client/byoc/aws/byoc.go:535 +0x145
github.com/DefangLabs/defang/src/pkg/cli/client/byoc/aws.(*ByocAws).getSecretID(...)
        /defang/src/pkg/cli/client/byoc/aws/byoc.go:609
github.com/DefangLabs/defang/src/pkg/cli/client/byoc/aws.(*ByocAws).PutConfig(0xc000222150, {0x21f6200, 0xc00038ad70}, 0xc000490600)
        /defang/src/pkg/cli/client/byoc/aws/byoc.go:616 +0x153
github.com/DefangLabs/defang/src/pkg/cli.ConfigSet({0x21f6200, 0xc00038ad70}, {0x21e78c0?, 0xc00069e180?}, {0x2207218, 0xc000222150}, {0x7fff226c1f9e, 0x8}, {0xc000014400, 0x4})
        /defang/src/pkg/cli/configSet.go:22 +0x17f
github.com/DefangLabs/defang/src/cmd/cli/command.init.func13(0x2f1fb60, {0xc00021cbc0, 0x1, 0x1?})
        /defang/src/cmd/cli/command/commands.go:723 +0x6d5
github.com/spf13/cobra.(*Command).execute(0x2f1fb60, {0xc00021cac0, 0x1, 0x1})
        /home/edw/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x2f1cd60)
        /home/edw/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/edw/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /home/edw/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1032
github.com/DefangLabs/defang/src/cmd/cli/command.Execute({0x21f6200, 0xc00038ad70})
        /defang/src/cmd/cli/command/commands.go:69 +0xb3
main.main()
        /defang/src/cmd/cli/main.go:38 +0x114

Checklist