coolify-cli icon indicating copy to clipboard operation
coolify-cli copied to clipboard

Servers list with json error, cannot unmarshal string into Go struct field Server.port of type int

Open magixus opened this issue 1 year ago • 2 comments

issue

coolify servers list json: cannot unmarshal string into Go struct field Server.port of type int

Steps to reproduce

  1. Install coolify on remote server
  2. Setup DNS for FQDN
  3. Test all good (access, resources, proxy ;... no issues at all)
  4. install CLI
  5. `coolify instances add -d "https://FQDN" "token"
  6. test coolify instances version => works fine
  7. test coolify servers list => error

magixus avatar Oct 29 '24 08:10 magixus

I have tested this in postman and it works, it listed all my servers. I think this is a go struct issue where the port has to be valide but in my case, FQDN is set and has no port

magixus avatar Oct 29 '24 08:10 magixus

Hi there. I've tried to reproduce it using your steps, but I don't get the issue that you had. Is this issue still occurring today or has it been resolved?

Image

OG-Jons avatar Apr 03 '25 15:04 OG-Jons

Hi,

this was fixed already, but I'd like to report that I am experiencing a similar issue with the latest pre-release:

$ coolify version
v0.0.2-rc1

(Commenting here instead of opening a new issue as this issue is not closed yet.)


To reproduce…

  • Running coolify servers list

    • enters gum (which was introduced in v0.0.2-rc1, so it was not there when this issue was reported), and
    • correctly shows my Coolify instance, but
    • throws an error after pressing enter in the Filter: prompt.
  • Error:

goroutine 1 [running]:
runtime/debug.Stack()
	/opt/hostedtoolcache/go/1.24.2/x64/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
	/opt/hostedtoolcache/go/1.24.2/x64/src/runtime/debug/stack.go:18 +0x13
github.com/charmbracelet/bubbletea.(*Program).recoverFromPanic(0xc0003b2280)
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:758 +0x8b
panic({0x9f5ca0?, 0xff2840?})
	/opt/hostedtoolcache/go/1.24.2/x64/src/runtime/panic.go:792 +0x132
github.com/coollabsio/cli-coolify/cmd/cliservers.initialListModel.func2.1({0x9c5380, 0xb9f1c0}, {0x9b01e0, 0x0})
	/home/runner/work/cli-coolify/cli-coolify/cmd/cliservers/list.go:111 +0x974
github.com/coollabsio/cli-coolify/cmd/cliservers.initialListModel.func2({0xba22e0?, 0xc000066180}, 0x1?)
	/home/runner/work/cli-coolify/cli-coolify/cmd/cliservers/list.go:176 +0x746
github.com/coollabsio/cli-coolify/pkg/tui.(*FilterableTable).updateTable(_, {_, _})
	/home/runner/work/cli-coolify/cli-coolify/pkg/tui/tablefilter.go:272 +0x23d
github.com/coollabsio/cli-coolify/pkg/tui.(*FilterableTable).Update(0xc000416008, {0xa51d00, 0xc0003809c0})
	/home/runner/work/cli-coolify/cli-coolify/pkg/tui/tablefilter.go:226 +0x1c7
github.com/coollabsio/cli-coolify/cmd/cliservers.listModel.Update(...)
	/home/runner/work/cli-coolify/cli-coolify/cmd/cliservers/list.go:197
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0003b2280, {0xba65b8?, 0xc0000d4a40?}, 0xc0003d82a0)
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:508 +0x7cd
github.com/charmbracelet/bubbletea.(*Program).Run(0xc0003b2280)
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:647 +0xabc
github.com/coollabsio/cli-coolify/cmd/cliservers.(*cliServers).newListCommand.func1(0xc0001eb508, {0x102b6c0?, 0x4?, 0xa9bd43?})
	/home/runner/work/cli-coolify/cli-coolify/cmd/cliservers/list.go:65 +0x265
github.com/spf13/cobra.(*Command).execute(0xc0001eb508, {0x102b6c0, 0x0, 0x0})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001e6008)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0xc0000b8420?)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041 +0x13
main.main()
	/home/runner/work/cli-coolify/cli-coolify/main.go:10 +0x2a
  • Exporting as JSON works fine:
coolify servers list --format json | jq .

Note: This is comparable to coolify servers list --pretty in v0.0.1.

  • Sample output:
[
  {
    "description": "This is the server where Coolify is running on. Don't delete this!",
    "ip": "host.docker.internal",
    "name": "localhost",
    "port": 22,
    "proxy": {
      "redirect_enabled": true
    },
    "settings": {
      "concurrent_builds": 2,
      "created_at": "2025-05-27T19:32:51.000000Z",
      "delete_unused_networks": false,
      "delete_unused_volumes": false,
      "docker_cleanup_frequency": "0 0 * * *",
      "docker_cleanup_threshold": 80,
      "dynamic_timeout": 3600,
      "force_disabled": false,
      "id": 1,
      "is_build_server": false,
      "is_cloudflare_tunnel": false,
      "is_jump_server": false,
      "is_logdrain_axiom_enabled": false,
      "is_logdrain_custom_enabled": false,
      "is_logdrain_highlight_enabled": false,
      "is_logdrain_newrelic_enabled": false,
      "is_metrics_enabled": true,
      "is_reachable": true,
      "is_sentinel_enabled": true,
      "is_swarm_manager": false,
      "is_swarm_worker": false,
      "is_usable": true,
      "sentinel_metrics_history_days": 7,
      "sentinel_metrics_refresh_rate_seconds": 10,
      "server_id": 0,
      "updated_at": "2025-05-27T22:14:22.000000Z",
      "wildcard_domain": "https://example.org"
    },
    "user": "root",
    "uuid": "xxxxxxxxxxxxxxxxxxxxxxx"
  }
]
  • As described above, this also works:

    curl -LsS -H "Authorization: Bearer ${COOLIFY_TOKEN}" "${COOLIFY_URL}/api/v1/servers"


I can confirm that this is working fine with v0.0.1 btw:

$ /usr/local/bin/coolify servers list                     
Uuid                     |Name     |IP Address  |User      |Port      |Reachable  |Usable
xxxxxxxxxxxxxxxxxxxxxxx  |example  |********    |********  |********  |true       |true

Note: Use -s to show sensitive information.
$ /usr/local/bin/coolify version
There is a new version of Coolify CLI available.
Please update with 'coolify --update'.

2025/05/27 22:59:38 New version of Coolify CLI is available: 0.0.2-rc1
0.0.1

redtux avatar May 27 '25 21:05 redtux