nats-io/natscli

slice bounds out of range when attempting to list consumers in a jetstream cluster

TomHellier opened this issue · 2 comments

Observed behavior

I'm attempting to list the consumers in a jetstream cluster using exec via:

  • the kubernetes dashboard.
  • argocd terminal interface

This works if I use kubectl, but I don't readily have access to that in all of the environments I deploy to.

~ # nats consumer ls
panic: runtime error: slice bounds out of range [:-2]

goroutine 1 [running]:
github.com/AlecAivazis/survey/v2.paginate(0x1a948e0?, {0xc0004c9320?, 0xc000465358?, 0xc000465388?}, 0x1005540?)
        /go/amd64/pkg/mod/github.com/!alec!aivazis/survey/v2@v2.3.7/survey.go:435 +0xad
github.com/AlecAivazis/survey/v2.(*Select).Prompt(0xc000414240, 0xc000192468)
        /go/amd64/pkg/mod/github.com/!alec!aivazis/survey/v2@v2.3.7/select.go:259 +0x3e5
github.com/AlecAivazis/survey/v2.Ask({0xc0004657f8, 0x1, 0xc000465808?}, {0xf431e0?, 0xc0004c56d0}, {0xc0004657f0, 0x1, 0x10ac6a0?})
        /go/amd64/pkg/mod/github.com/!alec!aivazis/survey/v2@v2.3.7/survey.go:366 +0x36f
github.com/AlecAivazis/survey/v2.AskOne(...)
        /go/amd64/pkg/mod/github.com/!alec!aivazis/survey/v2@v2.3.7/survey.go:283
github.com/nats-io/natscli/cli.askOne({0x13555e8, 0xc000414240}, {0xf431e0, 0xc0004c56d0}, {0x0, 0x0, 0x0?})
        /go/amd64/pkg/mod/github.com/nats-io/natscli@v0.1.1/cli/util.go:161 +0x193
github.com/nats-io/natscli/cli.selectStream(0x0?, {0x0, 0x0}, 0x0, 0x0)
        /go/amd64/pkg/mod/github.com/nats-io/natscli@v0.1.1/cli/util.go:143 +0x3f6
github.com/nats-io/natscli/cli.(*consumerCmd).connectAndSetup(0xc0001a7340, 0x1, 0x0, {0x0, 0x0, 0x0?})
        /go/amd64/pkg/mod/github.com/nats-io/natscli@v0.1.1/cli/consumer_command.go:1631 +0x1b6
github.com/nats-io/natscli/cli.(*consumerCmd).lsAction(0xc0001a7340, 0x0?)
        /go/amd64/pkg/mod/github.com/nats-io/natscli@v0.1.1/cli/consumer_command.go:491 +0x35
github.com/choria-io/fisk.(*actionMixin).applyActions(...)
        /go/amd64/pkg/mod/github.com/choria-io/fisk@v0.6.0/actions.go:28
github.com/choria-io/fisk.(*Application).applyActions(0xc0003c8f00?, 0xc00039e000)
        /go/amd64/pkg/mod/github.com/choria-io/fisk@v0.6.0/app.go:815 +0xdf
github.com/choria-io/fisk.(*Application).execute(0xc0003c8f00, 0xc00039e000?, {0xc0004a9100, 0x2, 0x2})
        /go/amd64/pkg/mod/github.com/choria-io/fisk@v0.6.0/app.go:609 +0x65
github.com/choria-io/fisk.(*Application).Parse(0xc0003c8f00, {0xc0001161c0?, 0xc0004c29b8?, 0xc0004c2a18?})
        /go/amd64/pkg/mod/github.com/choria-io/fisk@v0.6.0/app.go:272 +0x16c
github.com/choria-io/fisk.(*Application).MustParseWithUsage(0xc0003c8f00, {0xc0001161c0, 0x2, 0x2})
        /go/amd64/pkg/mod/github.com/choria-io/fisk@v0.6.0/app.go:881 +0x45
main.main()
        /go/amd64/pkg/mod/github.com/nats-io/natscli@v0.1.1/nats/main.go:74 +0x2a38

Expected behavior

Lists the consumers running in the jetstream cluster

Server and client version

cli v0.1.1
server
2.10.1-alpine

Host environment

kubernetes 1.27

Steps to reproduce

Attempt to use CLI in a terminal interface provided by common kubernetes tooling.

Related to #604

It also looks like github.com/AlecAivazis/survey is out of life, so probably worth transitioning to an alternative

Yeah, its a bit sad - and the alternatives are not great from a dependencies perspective