| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -5,6 +5,7 @@ package main | |
| import ( | ||
| "context" | ||
| log "github.com/sirupsen/logrus" | ||
| "go.amzn.com/lambda/interop" | ||
| "go.amzn.com/lambda/rapidcore" | ||
| "os" | ||
| "runtime/debug" | ||
| Expand All | @@ -28,6 +29,7 @@ type LsOpts struct { | |
| EdgePort string | ||
| EnableXRayTelemetry string | ||
| PostInvokeWaitMS string | ||
| MaxPayloadSize string | ||
| } | ||
|
|
||
| func GetEnvOrDie(env string) string { | ||
| Expand All | @@ -50,6 +52,7 @@ func InitLsOpts() *LsOpts { | |
| User: GetenvWithDefault("LOCALSTACK_USER", "sbx_user1051"), | ||
| InitLogLevel: GetenvWithDefault("LOCALSTACK_INIT_LOG_LEVEL", "warn"), | ||
| EdgePort: GetenvWithDefault("EDGE_PORT", "4566"), | ||
| MaxPayloadSize: GetenvWithDefault("LOCALSTACK_MAX_PAYLOAD_SIZE", "6291556"), | ||
|
Comment thread
dominikschubert marked this conversation as resolved.
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIntentionally no unit _BYTES vs. LAMBDA_LIMITS_MAX_FUNCTION_PAYLOAD_SIZE_BYTES in LocalStack (LOCALSTACK_POST_INVOKE_WAIT_MS also has a unit)
Sorry, something went wrong.
All reactions
|
||
| // optional or empty | ||
| CodeArchives: os.Getenv("LOCALSTACK_CODE_ARCHIVES"), | ||
| HotReloadingPaths: strings.Split(GetenvWithDefault("LOCALSTACK_HOT_RELOADING_PATHS", ""), ","), | ||
| Expand Down Expand Up | @@ -77,6 +80,7 @@ func UnsetLsEnvs() { | |
| "LOCALSTACK_INIT_LOG_LEVEL", | ||
| "LOCALSTACK_POST_INVOKE_WAIT_MS", | ||
| "LOCALSTACK_FUNCTION_ACCOUNT_ID", | ||
| "LOCALSTACK_MAX_PAYLOAD_SIZE", | ||
|
|
||
| // Docker container ID | ||
| "HOSTNAME", | ||
| Expand Down Expand Up | @@ -128,6 +132,13 @@ func main() { | |
| log.Fatal("Invalid value for LOCALSTACK_INIT_LOG_LEVEL") | ||
| } | ||
|
|
||
| // patch MaxPayloadSize | ||
| payloadSize, err := strconv.Atoi(lsOpts.MaxPayloadSize) | ||
| if err != nil { | ||
| log.Panicln("Please specify a number for LOCALSTACK_MAX_PAYLOAD_SIZE") | ||
| } | ||
| interop.MaxPayloadSize = payloadSize | ||
|
|
||
| // enable dns server | ||
| dnsServerContext, stopDnsServer := context.WithCancel(context.Background()) | ||
| go RunDNSRewriter(lsOpts, dnsServerContext) | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // LOCALSTACK CHANGES 2024-02-13: adjust error message for ErrorResponseTooLarge to be in parity with what AWS returns; make MaxPayloadSize adjustable | ||
|
|
||
| package interop | ||
|
|
||
| Expand All | @@ -18,10 +19,10 @@ import ( | |
| log "github.com/sirupsen/logrus" | ||
| ) | ||
|
|
||
| var MaxPayloadSize int = 6*1024*1024 + 100 // 6 MiB + 100 bytes | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualityannoying that we cannot use a single type due to mixed usages 😢 (server.go requires an int; not int64)
Sorry, something went wrong.
All reactions
|
||
|
|
||
| // MaxPayloadSize max event body size declared as LAMBDA_EVENT_BODY_SIZE | ||
| const ( | ||
| MaxPayloadSize = 6*1024*1024 + 100 // 6 MiB + 100 bytes | ||
|
|
||
| ResponseBandwidthRate = 2 * 1024 * 1024 // default average rate of 2 MiB/s | ||
| ResponseBandwidthBurstSize = 6 * 1024 * 1024 // default burst size of 6 MiB | ||
|
|
||
| Expand Down Expand Up | @@ -355,7 +356,7 @@ type ErrorResponseTooLargeDI struct { | |
|
|
||
| // ErrorResponseTooLarge is returned when response provided by Runtime does not fit into shared memory buffer | ||
| func (s *ErrorResponseTooLarge) Error() string { | ||
| return fmt.Sprintf("Response payload size (%d bytes) exceeded maximum allowed payload size (%d bytes).", s.ResponseSize, s.MaxResponseSize) | ||
| return fmt.Sprintf("Response payload size exceeded maximum allowed payload size (%d bytes).", s.MaxResponseSize) | ||
| } | ||
|
|
||
| // AsErrorResponse generates ErrorInvokeResponse from ErrorResponseTooLarge | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.