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

[Bug] API call for users/extensions panics #230

Closed
Xemdo opened this issue Apr 20, 2023 · 1 comment · Fixed by #233
Closed

[Bug] API call for users/extensions panics #230

Xemdo opened this issue Apr 20, 2023 · 1 comment · Fixed by #233
Assignees
Labels
bug Something isn't working

Comments

@Xemdo
Copy link
Contributor

Xemdo commented Apr 20, 2023

What is the problem?

When running twitch api get users/extensions -q user_id=<user id>, the cli panics.

Operating System

All

Architecture Version (x86, x64, arm, etc)

All

Steps to reproduce

  1. Run twitch api get users/extensions -q user_id=57047445
    Any User ID should do.

Relevant log output

> twitch api get users/extensions -q user_id=57047445
panic: interface conversion: interface {} is map[string]interface {}, not []interface {}

goroutine 1 [running]:
github.com/twitchdev/twitch-cli/internal/api.NewRequest({0xaa8a42, 0x3}, {0xc000127d48, 0x11}, {0xc0000900e0, 0x1, 0xc0000a2500?}, {0xf698a8, 0x0, 0x0}, ...)
        /go/src/github.com/twitchdev/twitch-cli/internal/api/api.go:178 +0x11c5
github.com/twitchdev/twitch-cli/cmd.cmdRun(0x98c8a0?, {0xc0000a61e0?, 0x3?, 0x3?})
        /go/src/github.com/twitchdev/twitch-cli/cmd/api.go:127 +0x2b0
github.com/spf13/cobra.(*Command).execute(0x98c8a0, {0xc0000a61b0, 0x3, 0x3})
        /go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x98da20)
        /go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x39d
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
github.com/twitchdev/twitch-cli/cmd.Execute()
        /go/src/github.com/twitchdev/twitch-cli/cmd/root.go:26 +0x25
main.main()
        /go/src/github.com/twitchdev/twitch-cli/main.go:16 +0x50
@Xemdo Xemdo added the bug Something isn't working label Apr 20, 2023
@Xemdo
Copy link
Contributor Author

Xemdo commented Apr 20, 2023

This is caused by the response being formatted differently than every other response. Its sent out as:

{
  "data": {
    "panel": {
      "1": {
        "active": true,
        "id": "rh6jq1q334hqc2rr1qlzqbvwlfl3x0",
        "version": "1.1.0",
        "name": "TopClip"
      },
      "2": {
        "active": true,
        "id": "wi08ebtatdc7oj83wtl9uxwz807l8b",
        "version": "1.1.8",
        "name": "Streamlabs Leaderboard"
      },
      "3": {
        "active": true,
        "id": "naty2zwfp7vecaivuve8ef1hohh6bo",
        "version": "1.0.9",
        "name": "Streamlabs Stream Schedule & Countdown"
      }
    },
    "overlay": {
      "1": {
        "active": true,
        "id": "zfh2irvx2jb4s60f02jq0ajm8vwgka",
        "version": "1.0.19",
        "name": "Streamlabs"
      }
    },
    "component": {
      "1": {
        "active": true,
        "id": "lqnf3zxk0rv0g7gq92mtmnirjz2cjj",
        "version": "0.0.1",
        "name": "Dev Experience Test",
        "x": 0,
        "y": 0
      },
      "2": {
        "active": false
      }
    }
  }
}

Or in production:

{
  "data": {
    "panel": {
      "1": {
        "active": false
      },
      "2": {
        "active": false
      },
      "3": {
        "active": false
      }
    },
    "overlay": {
      "1": {
        "active": true,
        "id": "wph0p912gucvcee0114kfoukn319db",
        "version": "0.0.3",
        "name": "Companion of the Lamb"
      }
    },
    "component": {
      "1": {
        "active": false
      },
      "2": {
        "active": false
      }
    }
  }
}

@Xemdo Xemdo self-assigned this Apr 21, 2023
@Xemdo Xemdo mentioned this issue Apr 21, 2023
4 tasks
@Xemdo Xemdo linked a pull request Apr 21, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant