Skip to content

Commit ed608f1

Browse files
committed
fix overriding of lambda.runtime
`Platform.runtime` was holding onto it before applying the Override()
1 parent 12b6e7e commit ed608f1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

config/lambda.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import (
44
"errors"
55
)
66

7+
// defaultRuntime is the default runtime.
8+
var defaultRuntime = "nodejs10.x"
9+
710
// defaultPolicy is the default function role policy.
811
var defaultPolicy = IAMPolicyStatement{
912
"Effect": "Allow",
@@ -56,7 +59,7 @@ func (l *Lambda) Default() error {
5659
}
5760

5861
if l.Runtime == "" {
59-
l.Runtime = "nodejs10.x"
62+
l.Runtime = defaultRuntime
6063
}
6164

6265
l.Policy = append(l.Policy, defaultPolicy)

platform/lambda/lambda.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ var apiGatewayAssumePolicy = `{
7777
// Platform implementation.
7878
type Platform struct {
7979
config *up.Config
80-
runtime string
8180
handler string
8281
zip *bytes.Buffer
8382
events event.Events
@@ -87,7 +86,6 @@ type Platform struct {
8786
func New(c *up.Config, events event.Events) *Platform {
8887
return &Platform{
8988
config: c,
90-
runtime: c.Lambda.Runtime,
9189
handler: "_proxy.handle",
9290
events: events,
9391
}
@@ -562,7 +560,7 @@ retry:
562560
res, err := c.CreateFunction(&lambda.CreateFunctionInput{
563561
FunctionName: &p.config.Name,
564562
Handler: &p.handler,
565-
Runtime: &p.runtime,
563+
Runtime: &p.config.Lambda.Runtime,
566564
Role: &p.config.Lambda.Role,
567565
MemorySize: aws.Int64(int64(p.config.Lambda.Memory)),
568566
Timeout: aws.Int64(int64(p.config.Proxy.Timeout + 3)),
@@ -626,7 +624,7 @@ func (p *Platform) updateFunction(c *lambda.Lambda, a *apigateway.APIGateway, up
626624
_, err = c.UpdateFunctionConfiguration(&lambda.UpdateFunctionConfigurationInput{
627625
FunctionName: &p.config.Name,
628626
Handler: &p.handler,
629-
Runtime: &p.runtime,
627+
Runtime: &p.config.Lambda.Runtime,
630628
Role: &p.config.Lambda.Role,
631629
MemorySize: aws.Int64(int64(p.config.Lambda.Memory)),
632630
Timeout: aws.Int64(int64(p.config.Proxy.Timeout + 3)),
@@ -814,7 +812,7 @@ func (p *Platform) roleName() string {
814812
func (p *Platform) deleteRole(region string) error {
815813
name := fmt.Sprintf("%s-function", p.config.Name)
816814
c := iam.New(session.New(aws.NewConfig().WithRegion(region)))
817-
815+
818816
// role is provided
819817
if s := p.config.Lambda.Role; s != "" {
820818
log.Debugf("using role from config %s; not deleting", s)

0 commit comments

Comments
 (0)