Skip to content

dpservice-cli crashes when running commands before initialisation #639

@vlorinc

Description

@vlorinc

Describe the bug
Dpservice-cli crashes when running commands before initialisation.
Not all commands have this issue; list nats ends correctly with error

To Reproduce
Run dpservice and before initialisation via dpservice-cli init run commands:

# dpservice-cli list lbprefixes 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x8acfd5]

goroutine 1 [running]:
github.com/ironcore-dev/dpservice/cli/dpservice-cli/cmd.RunListLoadBalancerPrefixes({0xa9ac88, 0xc00002e060}, {0xa95a00?, 0xc000012810?}, {0xa9ad68, 0xc000012900}, {{0x0, 0x0}, {0x0, 0x0}})
        /workspace/cli/dpservice-cli/cmd/list_loadbalancer_prefixes.go:79 +0x155
github.com/ironcore-dev/dpservice/cli/dpservice-cli/cmd.ListLoadBalancerPrefixes.func1(0xc0002c4300?, {0xe43d70?, 0x0?, 0x0?})
        /workspace/cli/dpservice-cli/cmd/list_loadbalancer_prefixes.go:32 +0x65
github.com/spf13/cobra.(*Command).execute(0xc0002c4300, {0xe43d70, 0x0, 0x0})
        /root/go/pkg/mod/github.com/spf13/[email protected]/command.go:983 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004600)
        /root/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x425
github.com/spf13/cobra.(*Command).Execute(0xc00011a738?)
        /root/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039 +0x19
main.main()
        /workspace/cli/dpservice-cli/main.go:21 +0x55

Expected behavior
It should exit with error not initialized like when listing nats:

# dpservice-cli list nats
Error running command: error listing nats: rpc error: code = Aborted desc = not initialized

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Archive

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions