You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: every sam local start-api request gets the same requestContext.requestId, requestTimeEpoch and requestTime #9279
Under sam local start-api every request the Lambda sees carries the same requestContext.requestId. requestTimeEpoch and requestTime are frozen the same way. The values get fixed when the process imports the module and they stay put until you restart the dev server. Deployed API Gateway hands out fresh ones per request, so it's a local versus deployed split.
It hits anything that keys off those fields. Log correlation collapses, because every line from every request carries one id. An idempotency or dedupe check sees the second request as a replay of the first. A handler that works out request age from requestTimeEpoch watches that age grow without bound while the server stays up, so past its threshold it rejects everything.
The values are default arguments, in RequestContext.__init__ and RequestContextV2.__init__ (samcli/local/events/api_event.py) and in construct_v2_event_http (samcli/local/apigw/event_constructor.py). Python evaluates a default once, at import time.
Steps to reproduce:
On develop at 5b20d0e, with the package installed from source. This drives the same service sam local start-api serves, so no Docker or AWS credentials are needed:
Same id, same epoch, same time string, for two requests sent 1.1 seconds apart. An HTTP API route with payload format 2.0 does the same, with timeEpoch in place of requestTimeEpoch and time in place of requestTime.
Expected result:
Two different requestId values, and a requestTimeEpoch that tracks the clock, the way deployed API Gateway behaves.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
OS: macOS 26.6.2 (Darwin 25.6.0)
sam --version: source checkout of develop at 5b20d0e, where samcli.__version__ is 1.166.2
AWS region: not used, the repro makes no AWS calls
Activity