SAP / cf-html5-apps-repo-cli-plugin

Cloud Foundry CLI plugin to work with SAP Cloud HTML5 Applications Repository
Apache License 2.0
43 stars 6 forks source link

html5-list not working with panic: runtime error: index out of range [1] with length 1 #69

Closed erlethor closed 8 months ago

erlethor commented 8 months ago

Description

Running: cf html5-list I get the following error: panic: runtime error: index out of range [1] with length 1

I tried to multiple orgs and spaces in canary. All showed the same error.

Environment

CLI Output

Set environment variable DEBUG=1, run the flow and paste output here.

13:48:45.775704 Running CloudFoundry html5-plugin 1.4.8
13:48:45.776027 Initializing command 'html5-list'
13:48:45.776670 Configuration file does not exist. No cache to clear
13:48:45.776680 Executing command 'html5-list': args: '[]'
13:48:45.776685 Getting context (org/space/username)
Getting list of HTML5 applications in org ... / space ... as ...
13:48:45.778494 Getting HTML5 context
13:48:45.778497 Getting list of services
13:48:45.778926 Making request to: /v3/service_offerings?space_guids=...
13:48:46.078462 Looking for 'html5-apps-repo' service
13:48:46.078482 Getting service plans for 'html5-apps-repo' service (GUID: ...)
13:48:46.078486 Making request to: /v3/service_plans?service_offering_guids=...
13:48:46.304250 Looking for app-runtime service plan
13:48:46.304301 Getting service instances of 'html5-apps-repo' service app-runtime plan (&{Name:app-runtime GUID:...})
13:48:46.304341 Making request to: /v3/service_instances?service_plan_guids=...&space_guids=...
13:48:46.550195 Service instance app-runtime-1707144030 is potentially broken and will not be reused
13:48:46.550249 Service instance app-runtime-1707240021 is potentially broken and will not be reused
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
cf-html5-apps-repo-cli-plugin/commands.(*HTML5Command).GetHTML5Context(0x104819920, {{0x1400009e800, 0x19}, {0x1400009eb40, 0x1c}, {0x140000a4900, 0x24}, {0x140000a0830, 0xf}, {0x140000a4ba0, ...}})
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_base_command.go:299 +0x141c
cf-html5-apps-repo-cli-plugin/commands.(*ListCommand).ListApps(0x104819920, 0x0)
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_list_command.go:722 +0x308
cf-html5-apps-repo-cli-plugin/commands.(*ListCommand).Execute(0x104819920, {0x140000121d0?, 0x0, 0x0})
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_list_command.go:57 +0x100
main.(*HTML5Plugin).Run(0x1400002b440?, {0x1045cb1e8, 0x1400002b440}, {0x140000121d0, 0x1, 0x1})
        go/src/cf-html5-apps-repo-cli-plugin/html5_plugin.go:52 +0x23c
cf-html5-apps-repo-cli-plugin/vendor/github.com/cloudfoundry/cli/plugin.Start({0x1045c6740, 0x10484f740})
        go/src/cf-html5-apps-repo-cli-plugin/vendor/github.com/cloudfoundry/cli/plugin/plugin_shim.go:30 +0x2c0
main.main()
        go/src/cf-html5-apps-repo-cli-plugin/html5_plugin.go:74 +0x2c
micellius commented 8 months ago

Hi @erlethor , Thanks for reporting an issue!

The issue you are facing is relevant to async nature of service instance and service keys deletion in CF API v3. In html5-plugin version 1.4.8 the plugin created two jobs of deleting temporary service key and service instance of app-runtime (during clean-up phase) without waiting for completion of the previous job. This results to unpredicted results that left the temporary created app-runtime-<timestamp> instance in "Failed to delete" state. You should be able to delete these instances (app-runtime-1707144030 and app-runtime-1707240021) in a regular way, with cf ds <instance_name>.

In html5-plugin version 1.4.9 the issue was fixed by awaiting all service key deletion jobs progress to completed state before scheduling service instance deletion job.

The official CF CLI Plugins repository does not yet support the Apple Silicon binaries, but you can install the html5-plugin from GitHub releases:

cf install-plugin -f https://github.com/SAP/cf-html5-apps-repo-cli-plugin/releases/latest/download/cf-html5-apps-repo-cli-plugin-darwin-arm64
erlethor commented 8 months ago

Hi @micellius, Thank you for the hint with cf ds... it worked well. Now html5-list ist working again.

I also updated to 1.4.9, but after the deletion.