Skip to content

Commit f0543f4

Browse files
committed
fixes error messaging - physical resource id is always required
1 parent 3d0bef9 commit f0543f4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cfn/wrap.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,16 @@ func lambdaWrapWithClient(lambdaFunction CustomResourceFunction, client httpClie
2222
fn = func(ctx context.Context, event Event) (reason string, err error) {
2323
r := NewResponse(&event)
2424
r.PhysicalResourceID, r.Data, err = lambdaFunction(ctx, event)
25-
25+
if r.PhysicalResourceID == "" {
26+
log.Println("PhysicalResourceID must exist, copying Log Stream name")
27+
r.PhysicalResourceID = lambdacontext.LogStreamName
28+
}
2629
if err != nil {
2730
r.Status = StatusFailed
2831
r.Reason = err.Error()
2932
log.Printf("sending status failed: %s", r.Reason)
3033
} else {
3134
r.Status = StatusSuccess
32-
33-
if r.PhysicalResourceID == "" {
34-
log.Println("PhysicalResourceID must exist on creation, copying Log Stream name")
35-
r.PhysicalResourceID = lambdacontext.LogStreamName
36-
}
3735
}
3836

3937
err = r.sendWith(client)

0 commit comments

Comments
 (0)