Skip to content

Commit 691bb59

Browse files
author
Mouad Belbah
committed
Return latest lambda function with explicit version number
1 parent 589b052 commit 691bb59

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

deploy.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ const getLatestVersion = lambdaMapping =>
4444
getLastPageOfVersions(lambdaMapping)
4545
.then(
4646
res =>
47-
res.Versions.sort(
48-
(a, b) => (parseInt(a.Version) > parseInt(b.Version) ? -1 : 1)
49-
)[0]
47+
res.Versions.reduce((prev, curr) => (
48+
isNaN(curr.Version)
49+
|| parseInt(prev.Version) > parseInt(curr.Version) ? prev : curr
50+
))
5051
)
5152
.then(latest => ({
5253
EventType: lambdaMapping.EventType,

0 commit comments

Comments
 (0)