Skip to content

Commit c3dc404

Browse files
authored
fix missing prefix while listing cloud run resources (#748)
1 parent d5d9036 commit c3dc404

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/providers/gcp/cloud-run.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"strings"
88

99
"github.com/projectdiscovery/cloudlist/pkg/schema"
10+
"github.com/projectdiscovery/gologger"
1011
run "google.golang.org/api/run/v1"
1112
)
1213

@@ -55,13 +56,16 @@ func (d *cloudRunProvider) getServices() ([]*run.Service, error) {
5556
locationsService := d.run.Projects.Locations.List(fmt.Sprintf("projects/%s", project))
5657
locationsResponse, err := locationsService.Do()
5758
if err != nil {
59+
gologger.Warning().Msgf("could not list cloud run locations for project %s: %s", project, err)
5860
continue
5961
}
6062

6163
for _, location := range locationsResponse.Locations {
62-
servicesService := d.run.Projects.Locations.Services.List(location.Name)
63-
servicesResponse, err := servicesService.Do()
64+
// build the parent explicitly because the location.Name is not returned with the projects/ prefix in Knative API
65+
parent := fmt.Sprintf("projects/%s/locations/%s", project, location.LocationId)
66+
servicesResponse, err := d.run.Projects.Locations.Services.List(parent).Do()
6467
if err != nil {
68+
gologger.Warning().Msgf("could not list cloud run services for %s: %s", parent, err)
6569
continue
6670
}
6771
services = append(services, servicesResponse.Items...)

0 commit comments

Comments
 (0)