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
docs: Fix outdated README sections on API keys, debugging and reloads - #1918
"Token authorizers" is now "API keys". It says --apiKey was removed in v11, that keys with a value in provider.apiGateway.apiKeys are accepted, and that a random key is only generated when no key has a value. It includes a stage-based example for a local-only key.
The "Debug process" section is rewritten. With the Serverless v4 binary, node --inspect serverless and NODE_OPTIONS=--inspect don't reach the framework process. The new recipe opens the inspector via --preLoadModules "$PWD/start-debugger.mjs". The preLoadModules option now says that entries are resolved from the plugin, so local files need an absolute path.
New "Reloading handlers after code changes" section, covering reloadHandler, the offline:functionsUpdated lifecycle event (with a serverless-offline-watcher example), and why neither works with useInProcess.
New "Handler lifecycle" section, covering instance reuse, the termination timing, in-process shared state, and that callbackWaitsForEmptyEventLoop is ignored. terminateIdleLambdaTime now lists its default.
New Go section: without Docker, handler must point to the .go source; binary handlers and provided.* need --useDocker.
How it was checked
Each statement was checked against master, and against #1917 where that PR touches the same code (preLoadModules, LambdaFunctionPool, GoRunner); #1917 doesn't change any of the documented behaviour.
These were also run against Serverless v4.43.0:
--debug: prints the Lambda invocation routes.
Debugger recipe: the inspector opens in the framework process, and the handler's worker thread can be attached to over the inspector protocol. A relative preLoadModules path fails with ERR_MODULE_NOT_FOUND. NODE_OPTIONS=--inspect gets the port taken by the launcher process, so the framework process fails to start the inspector ("address already in use").
API key example: on the local stage the fixed key is accepted and a request without a key gets 403. On prod, a random key is printed and the local key is rejected.
- API keys: --apiKey was removed in v11, document how configured key
values and the random key work, with a stage-based example
- Debug logs: SLS_DEBUG no longer works, use --debug
- Interactive debugging: node --inspect doesn't reach the framework
process with the Serverless v4 binary, open the inspector through
preLoadModules instead
- Reloading: document that handlers are cached, reloadHandler, the
offline:functionsUpdated lifecycle event, and that neither works
in-process
- Run modes: document the handler lifecycle, that
callbackWaitsForEmptyEventLoop is ignored, and how Go handlers
have to be configured
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Go handlers without Docker and Java handlers aren't kept between
invocations, so the reuse and termination rules don't apply to them
- callbackWaitsForEmptyEventLoop is only ignored for Node.js handlers
outside of Docker, the AWS runtime in the container honours it
- Plain string API keys are currently accepted as key values (#1749)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Avoid requiring x-api-key when authorizer supplies usageIdentifierKey
README.md:544
A request without x-api-key can still succeed when a custom authorizer returns a valid usageIdentifierKey. createAuthScheme.js forwards that value, and HttpServer.js checks it when the header is absent. Qualify the header requirement so this supported alternative is not described as returning 403.
Re the "previously missed" finding in the latest Copilot review (usageIdentifierKey): agreed, fixed in 0abcb07. The API keys section now says a request also passes when a Lambda authorizer returns a valid key as usageIdentifierKey (checked in HttpServer.js when the x-api-key header is absent).
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
The documented idle-cleanup behavior depends on #1917, which remains unmerged.
Review effort: Balanced Findings: None
Previously missed (1)
In code that hasn't changed since last review
Idle Lambda termination timeout is not a guaranteed maximum
README.md:344
Twice terminateIdleLambdaTime is not a guaranteed maximum, even after #1917. The pool waits for all idle-instance cleanups to settle before scheduling its next check, so a slow cleanup can delay termination of other idle instances. Describe one to two timeouts as approximate and note that cleanup or event-loop delays can extend it.
Re the "previously missed" finding in the latest Copilot review (idle termination timing): agreed, fixed in 2f1dfbe. The cleaner awaits the running cleanups before scheduling its next check, so the README now says an idle instance usually lives one to two times terminateIdleLambdaTime, and longer while a previous cleanup is still in progress.
Renaming this heading leaves the table of contents at README.md:60 pointing to #token-authorizers, which no longer exists. Update that entry to [API keys](#api-keys) so the navigation link still works.
- The table of contents still linked to the renamed "Token
authorizers" heading
- Only worker threads are terminated abruptly, child processes get a
SIGTERM and Docker containers are stopped with docker stop
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re the "previously missed" finding in the latest Copilot review (TOC link): agreed, fixed in 2630c29. The table of contents now links to #api-keys, and all 39 internal links in the README resolve.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the README sections that eight open issues show are wrong or missing. Only the README changes.
--apiKeywas removed in v11, that keys with avalueinprovider.apiGateway.apiKeysare accepted, and that a random key is only generated when no key has a value. It includes a stage-based example for a local-only key.SLS_DEBUG=*is replaced with--debug, and the sample output now matches v14.node --inspect serverlessandNODE_OPTIONS=--inspectdon't reach the framework process. The new recipe opens the inspector via--preLoadModules "$PWD/start-debugger.mjs". ThepreLoadModulesoption now says that entries are resolved from the plugin, so local files need an absolute path.reloadHandler, theoffline:functionsUpdatedlifecycle event (with a serverless-offline-watcher example), and why neither works withuseInProcess.callbackWaitsForEmptyEventLoopis ignored.terminateIdleLambdaTimenow lists its default.handlermust point to the.gosource; binary handlers andprovided.*need--useDocker.How it was checked
Each statement was checked against
master, and against #1917 where that PR touches the same code (preLoadModules,LambdaFunctionPool,GoRunner); #1917 doesn't change any of the documented behaviour.These were also run against Serverless v4.43.0:
--debug: prints the Lambda invocation routes.preLoadModulespath fails withERR_MODULE_NOT_FOUND.NODE_OPTIONS=--inspectgets the port taken by the launcher process, so the framework process fails to start the inspector ("address already in use").localstage the fixed key is accepted and a request without a key gets 403. Onprod, a random key is printed and the local key is rejected.prettier --check README.mdpasses.Closes #1358
Closes #1531
Closes #1608
Closes #1657
Closes #1659
Closes #1660
Closes #1695
Closes #1810
🤖 Generated with Claude Code