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` throws an error #73

Open hakimio opened 4 months ago

hakimio commented 4 months ago

Description

Trying to run the following command, getting nil pointer dereference error:

cf html5-list -di my-destination-service -u

Error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x28 pc=0xa914f5]

goroutine 1 [running]:
cf-html5-apps-repo-cli-plugin/commands.(*HTML5Context).GetRuntimeURL(0xc000071780, {0x0, 0x0})
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_base_command.go:425 +0x55
cf-html5-apps-repo-cli-plugin/commands.(*ListCommand).ListDestinationApps(0xe58400, {0xc000014138, 0x17}, 0x1, {0x0, 0x0})
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_list_command.go:379 +0x1d05
cf-html5-apps-repo-cli-plugin/commands.(*ListCommand).Execute(0xe58400, {0xc000072030?, 0x3, 0x5})
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_list_command.go:161 +0xd1e
main.(*HTML5Plugin).Run(0xb501d3?, {0xbf71f0, 0xc0000273f0}, {0xc000072020, 0x4, 0x6})
        go/src/cf-html5-apps-repo-cli-plugin/html5_plugin.go:52 +0x2a8
cf-html5-apps-repo-cli-plugin/vendor/github.com/cloudfoundry/cli/plugin.Start({0xbf22a8, 0xead1c0})
        go/src/cf-html5-apps-repo-cli-plugin/vendor/github.com/cloudfoundry/cli/plugin/plugin_shim.go:30 +0x2d4
main.main()
        go/src/cf-html5-apps-repo-cli-plugin/html5_plugin.go:74 +0x25

Environment

CLI Output

12:16:09.727611 Running CloudFoundry html5-plugin 1.4.9
12:16:09.729205 Initializing command 'html5-list'
12:16:09.730873 Configuration file does not exist. No cache to clear
12:16:09.730873 Executing command 'html5-list': args: '[-di <REDACTED>-destination-service -u]'
12:16:09.731393 Listing HTML5 applications available via destinations
12:16:09.731934 Getting context (org/space/username)
Getting list of HTML5 applications available via destinations in org <REDACTED>...
12:16:09.735241 Getting HTML5 context
12:16:09.735772 Getting list of services
12:16:09.736924 Making request to: /v3/service_offerings?space_guids=<REDACTED>
12:16:10.983886 [ RESPONSE OMITTED ]
12:16:10.985860 Updating cache with 18 service offerings
12:16:10.985860 Looking for 'html5-apps-repo' service
12:16:10.986454 Getting service plans for 'html5-apps-repo' service (GUID: <REDACTED>)
12:16:10.986996 Making request to: /v3/service_plans?service_offering_guids=<REDACTED>
12:16:11.453475 [ RESPONSE OMITTED ]
12:16:11.454852 Looking for app-runtime service plan
12:16:11.456659 Getting service instances of 'html5-apps-repo' service app-runtime plan (&{Name:app-runtime GUID:<REDACTED>})
12:16:11.459044 Making request to: /v3/service_instances?service_plan_guids=<REDACTED>
12:16:11.925571 [ RESPONSE OMITTED ]
12:16:11.927458 Getting list of service keys for service frontend-runtime
12:16:11.929533 Making request to: /v3/service_credential_bindings?service_instance_guids=<REDACTED>
12:16:12.359586 [ RESPONSE OMITTED ]
12:16:12.366735 Making request to: https://api.cf.us10-001.hana.ondemand.com/v3/service_credential_bindings/<REDACTED>/details
12:16:12.884126 [ RESPONSE OMITTED ]
12:16:12.892332 Found 1 service keys for service frontend-runtime, using service key with GUID=45a3e258-8538-4517-876c-9b78949ca1d5
12:16:12.893861 Getting token for service key
12:16:12.895626 Making request to: https://<REDACTED>.authentication.us10.hana.ondemand.com/oauth/token
12:16:13.400885 [ RESPONSE OMITTED ]
12:16:13.409178 Access token for service key : [ SENSITIVE DATA ]
12:16:13.411041 Getting list of services
12:16:13.416142 Returning cached list of services
12:16:13.416770 Looking for 'destination' service
12:16:13.418832 Destination service found: &{Name:destination GUID:<REDACTED>}
12:16:13.420836 Getting service plans for 'destination' service (GUID: <REDACTED>)
12:16:13.423289 Making request to: /v3/service_plans?service_offering_guids=<REDACTED>
12:16:13.895156 [ RESPONSE OMITTED ]
12:16:13.896767 Destination service 'lite' plan found: &{Name:lite GUID:<REDACTED>}
12:16:13.899000 Getting service instances of 'destination' service 'lite' plan (&{Name:lite GUID:<REDACTED>})
12:16:13.901571 Making request to: /v3/service_instances?service_plan_guids=<REDACTED>&space_guids=<REDACTED>
12:16:14.482270 [ RESPONSE OMITTED ]
12:16:14.483610 Using service instance of 'destination' service 'lite' plan: {Name:<REDACTED>-destination-service GUID:<REDACTED> UpdatedAt:2024-07-15T07:32:51Z LastOperation:{Type:update State:succeeded Description: UpdatedAt:2024-07-15T09:53:39Z CreatedAt:2024-07-15T09:53:39Z}}
12:16:14.486035 Creating service key for 'destination' service 'lite' plan
12:16:14.493255 Making request to: https://api.cf.us10-001.hana.ondemand.com/v3/service_credential_bindings {"type":"key","name":"html5-key-1721038574","relationships":{"service_instance":{"data":{"guid":"<REDACTED>"}}}}
12:16:14.878033 [ RESPONSE OMITTED ]
12:16:14.879569 Getting job by URL: https://api.cf.us10-001.hana.ondemand.com/v3/jobs/c934ae27-d53e-48b6-9247-e2df9f495338 (try 1/10)
12:16:14.884743 Making request to: https://api.cf.us10-001.hana.ondemand.com/v3/jobs/c934ae27-d53e-48b6-9247-e2df9f495338
12:16:15.237757 [ RESPONSE OMITTED ]
12:16:16.242525 Getting job by URL: https://api.cf.us10-001.hana.ondemand.com/v3/jobs/c934ae27-d53e-48b6-9247-e2df9f495338 (try 2/10)
12:16:16.247503 Making request to: https://api.cf.us10-001.hana.ondemand.com/v3/jobs/c934ae27-d53e-48b6-9247-e2df9f495338
12:16:16.595370 [ RESPONSE OMITTED ]
12:16:16.601417 Making request to: https://api.cf.us10-001.hana.ondemand.com/v3/service_credential_bindings/d5599d5a-5a66-4e29-959e-68dd7a7345f8
12:16:16.984445 [ RESPONSE OMITTED ]
12:16:17.000054 Making request to: https://api.cf.us10-001.hana.ondemand.com/v3/service_credential_bindings/d5599d5a-5a66-4e29-959e-68dd7a7345f8/details
12:16:17.413537 [ RESPONSE OMITTED ]
12:16:17.424813 Getting token for service key html5-key-1721038574
12:16:17.425671 Making request to: https://<REDACTED>.authentication.us10.hana.ondemand.com/oauth/token
12:16:17.898868 [ RESPONSE OMITTED ]
12:16:17.903910 Access token for service key html5-key-1721038574: [ SENSITIVE DATA ]
12:16:17.905949 Making request to: https://destination-configuration.cfapps.us10.hana.ondemand.com/destination-configuration/v1/instanceDestinations/
12:16:18.315367 [ RESPONSE OMITTED ]
12:16:18.327149 List of service instance destinations: [{Name:<REDACTED>-frontend-host Description: Type:HTTP URL:https://sap.com/DUMMY_URL Authentication:OAuth2ClientCredentials ProxyType:Internet TokenServiceURL:https://<REDACTED>-dk.authentication.us10.hana.ondemand.com/oauth/token TokenServiceURLType: ClientID:sb-d5c5426b-13c1-4096-bcd1-649f0fa4fabd!b306729|html5-apps-repo-uaa!b424 ClientSecret:64674ebf-dde8-4528-9662-3c03da4f4977$rirEgxaBhfA2nqNBHZVPdTTqyh64eNTNM-NUDPPBdMo= Properties:map[ServiceKeyName:frontend-host-key app_host_id:d5c5426b-13c1-4096-bcd1-649f0fa4fabd content_endpoint:https://html5-apps-repo-dt.cfapps.us10.hana.ondemand.com saasregistryenabled:true sap.cloud.service:<REDACTED> uri:https://html5-apps-repo-dt.cfapps.us10.hana.ondemand.com xsappname:d5c5426b-13c1-4096-bcd1-649f0fa4fabd!b306729|html5-apps-repo-uaa!b424] DestinationServiceInstanceName:<REDACTED>-destination-service}]
12:16:18.329841 Processing destination: {Name:<REDACTED>-frontend-host Description: Type:HTTP URL:https://sap.com/DUMMY_URL Authentication:OAuth2ClientCredentials ProxyType:Internet TokenServiceURL:https://<REDACTED>-dk.authentication.us10.hana.ondemand.com/oauth/token TokenServiceURLType: ClientID:sb-d5c5426b-13c1-4096-bcd1-649f0fa4fabd!b306729|html5-apps-repo-uaa!b424 ClientSecret:64674ebf-dde8-4528-9662-3c03da4f4977$rirEgxaBhfA2nqNBHZVPdTTqyh64eNTNM-NUDPPBdMo= Properties:map[ServiceKeyName:frontend-host-key app_host_id:d5c5426b-13c1-4096-bcd1-649f0fa4fabd content_endpoint:https://html5-apps-repo-dt.cfapps.us10.hana.ondemand.com saasregistryenabled:true sap.cloud.service:<REDACTED> uri:https://html5-apps-repo-dt.cfapps.us10.hana.ondemand.com xsappname:d5c5426b-13c1-4096-bcd1-649f0fa4fabd!b306729|html5-apps-repo-uaa!b424] DestinationServiceInstanceName:<REDACTED>-destination-service}
12:16:18.332552 Destination '<REDACTED>-frontend-host' has 'sap.cloud.service' property: <REDACTED>
12:16:18.334412 Getting list of applications for app-host-id 'd5c5426b-13c1-4096-bcd1-649f0fa4fabd' of service '<REDACTED>' defined in destination with name '<REDACTED>-frontend-host'
12:16:18.337171 Making request to: https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/applications/metadata/
12:16:18.949946 [ RESPONSE OMITTED ]
12:16:18.960161 Got list of applications for app-host-id 'd5c5426b-13c1-4096-bcd1-649f0fa4fabd' of service '<REDACTED>' defined in destination with name '<REDACTED>-frontend-host': [{ApplicationName:frontend ApplicationVersion:1.0.0 ChangedOn:Mon, 15 Jul 2024 09:55:23 GMT CreatedOn:Fri, 12 Jul 2024 14:00:17 GMT IsDefault:true IsPublic:true}]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x28 pc=0xa914f5]

goroutine 1 [running]:
cf-html5-apps-repo-cli-plugin/commands.(*HTML5Context).GetRuntimeURL(0xc000071780, {0x0, 0x0})
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_base_command.go:425 +0x55
cf-html5-apps-repo-cli-plugin/commands.(*ListCommand).ListDestinationApps(0xe58400, {0xc000010150, 0x17}, 0x1, {0x0, 0x0})
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_list_command.go:379 +0x1d05
cf-html5-apps-repo-cli-plugin/commands.(*ListCommand).Execute(0xe58400, {0xc000072030?, 0x3, 0x5})
        go/src/cf-html5-apps-repo-cli-plugin/commands/html5_list_command.go:161 +0xd1e
main.(*HTML5Plugin).Run(0xb501d3?, {0xbf71f0, 0xc0000273f0}, {0xc000072020, 0x4, 0x6})
        go/src/cf-html5-apps-repo-cli-plugin/html5_plugin.go:52 +0x2a8
cf-html5-apps-repo-cli-plugin/vendor/github.com/cloudfoundry/cli/plugin.Start({0xbf22a8, 0xead1c0})
        go/src/cf-html5-apps-repo-cli-plugin/vendor/github.com/cloudfoundry/cli/plugin/plugin_shim.go:30 +0x2d4
main.main()
        go/src/cf-html5-apps-repo-cli-plugin/html5_plugin.go:74 +0x25
hakimio commented 4 months ago

Older version (1.4.7) seems to work fine.

pinakipatrapro commented 4 months ago

Similar Error here:

Failed to get service key details: [404] [123 34 101 114 114 111 114 115 34 58 91 123 34 100 101 116 97 105 108 34 58 34 68 101 108 101 116 105 111 110 32 111 102 32 115 101 114 118 105 99 101 32 107 101 121 32 102 97 105 108 101 100 34 44 34 116 105 116 108 101 34 58 34 67 70 45 82 101 115 111 117 114 99 101 78 111 116 70 111 117 110 100 34 44 34 99 111 100 101 34 58 49 48 48 49 48 125 93 125]