@@ -5,6 +5,7 @@ package main
55import (
66 "context"
77 log "github.com/sirupsen/logrus"
8+ "go.amzn.com/lambda/interop"
89 "go.amzn.com/lambda/rapidcore"
910 "os"
1011 "runtime/debug"
@@ -28,6 +29,7 @@ type LsOpts struct {
2829 EdgePort string
2930 EnableXRayTelemetry string
3031 PostInvokeWaitMS string
32+ MaxPayloadSize string
3133}
3234
3335func GetEnvOrDie (env string ) string {
@@ -50,6 +52,7 @@ func InitLsOpts() *LsOpts {
5052 User : GetenvWithDefault ("LOCALSTACK_USER" , "sbx_user1051" ),
5153 InitLogLevel : GetenvWithDefault ("LOCALSTACK_INIT_LOG_LEVEL" , "warn" ),
5254 EdgePort : GetenvWithDefault ("EDGE_PORT" , "4566" ),
55+ MaxPayloadSize : GetenvWithDefault ("LOCALSTACK_MAX_PAYLOAD_SIZE" , "6291556" ),
5356 // optional or empty
5457 CodeArchives : os .Getenv ("LOCALSTACK_CODE_ARCHIVES" ),
5558 HotReloadingPaths : strings .Split (GetenvWithDefault ("LOCALSTACK_HOT_RELOADING_PATHS" , "" ), "," ),
@@ -77,6 +80,7 @@ func UnsetLsEnvs() {
7780 "LOCALSTACK_INIT_LOG_LEVEL" ,
7881 "LOCALSTACK_POST_INVOKE_WAIT_MS" ,
7982 "LOCALSTACK_FUNCTION_ACCOUNT_ID" ,
83+ "LOCALSTACK_MAX_PAYLOAD_SIZE" ,
8084
8185 // Docker container ID
8286 "HOSTNAME" ,
@@ -128,6 +132,13 @@ func main() {
128132 log .Fatal ("Invalid value for LOCALSTACK_INIT_LOG_LEVEL" )
129133 }
130134
135+ // patch MaxPayloadSize
136+ payloadSize , err := strconv .Atoi (lsOpts .MaxPayloadSize )
137+ if err != nil {
138+ log .Panicln ("Please specify a number for LOCALSTACK_MAX_PAYLOAD_SIZE" )
139+ }
140+ interop .MaxPayloadSize = payloadSize
141+
131142 // enable dns server
132143 dnsServerContext , stopDnsServer := context .WithCancel (context .Background ())
133144 go RunDNSRewriter (lsOpts , dnsServerContext )
0 commit comments