Skip to content
This repository has been archived by the owner on Sep 3, 2020. It is now read-only.

Commit

Permalink
fix support for >50 lambda versions. Closes https://github.com/apex/a…
Browse files Browse the repository at this point in the history
  • Loading branch information
kcolemangt authored and tj committed May 8, 2018
1 parent 72e87d9 commit 8237e93
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,15 +724,28 @@ func (f *Function) cleanup() error {

// versions returns list of all versions deployed to AWS Lambda
func (f *Function) versions() ([]*lambda.FunctionConfiguration, error) {
list, err := f.Service.ListVersionsByFunction(&lambda.ListVersionsByFunctionInput{
var list []*lambda.FunctionConfiguration
request := lambda.ListVersionsByFunctionInput{
FunctionName: &f.FunctionName,
})
}

if err != nil {
return nil, err
for {
page, err := f.Service.ListVersionsByFunction(&request)

if err != nil {
return nil, err
}

list = append(list, page.Versions...)

if page.NextMarker == nil {
break
}

request.Marker = page.NextMarker
}

versions := list.Versions[1:] // remove $LATEST
versions := list[1:] // remove $LATEST
return versions, nil
}

Expand Down

0 comments on commit 8237e93

Please sign in to comment.