Skip to content

docs: Fix outdated README sections on API keys, debugging and reloads - #1918

Merged
dherault merged 6 commits into
masterfrom
docs/refresh-outdated-readme-sections
Oct 5, 2026
Merged

dherault merged 6 commits into
masterfrom
docs/refresh-outdated-readme-sections

Conversation

@dherault

@dherault dherault commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Updates the README sections that eight open issues show are wrong or missing. Only the README changes.

Issue Change
#1608, #1695 "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.
#1657 SLS_DEBUG=* is replaced with --debug, and the sample output now matches v14.
#1810 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.
#1659, #1660 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.
#1531 New "Handler lifecycle" section, covering instance reuse, the termination timing, in-process shared state, and that callbackWaitsForEmptyEventLoop is ignored. terminateIdleLambdaTime now lists its default.
#1358 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.

prettier --check README.md passes.

Closes #1358
Closes #1531
Closes #1608
Closes #1657
Closes #1659
Closes #1660
Closes #1695
Closes #1810

🤖 Generated with Claude Code

- 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>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

API-key and runtime lifecycle descriptions still conflict with the implementation.

Review effort: Balanced
Findings: 1 High severity · 3 Medium severity

Open (4)
What changed in this PR

Updates serverless-offline’s README to address outdated guidance reported across eight issues.

Changes:

  • Revises API-key configuration and Serverless v4 debugging instructions.
  • Documents handler reuse, cleanup, and reload options.
  • Explains Go source-handler and Docker requirements.
File Description
README.md Updates configuration, debugging, and runtime lifecycle guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
- 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>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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 unmerged PR #1917, so the agreed merge order needs human confirmation.

Review effort: Balanced
Findings: None

Resolved since last review (4)
Previously missed (1)

In code that hasn't changed since last review

Low severity 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 09:30
@dherault

dherault commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

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).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Low severity 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 09:35
@dherault

dherault commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The documented cleanup behavior depends on still-unmerged PR #1917, so merge order requires verification.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Previously missed (1)

In code that hasn't changed since last review

Low severity Update README TOC link after renaming the heading

README.md:542

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.

Comment thread README.md Outdated
- 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>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 09:41
@dherault

dherault commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

Only a minor documentation qualification remains, and the prerequisite fix has merged.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

Comment thread README.md Outdated
PythonRunner starts the interpreter with shell: true, so kill() may
only reach the shell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 09:48
@dherault
dherault deployed to fork-pr-tests October 5, 2026 09:48 — with GitHub Actions Active
@dherault
dherault deployed to fork-pr-tests October 5, 2026 09:48 — with GitHub Actions Active
@dherault
dherault deployed to fork-pr-tests October 5, 2026 09:48 — with GitHub Actions Active
@dherault
dherault deployed to fork-pr-tests October 5, 2026 09:48 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The documentation matches the reviewed implementation, and prior feedback is resolved.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@dherault
dherault merged commit 709ba2d into master Oct 5, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
fork-pr-tests — c65db7b4 Deployed Oct 5, 2026 by dherault via Node.js v22 #59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants