feat: Serverless Framework v4 support + plugin hardening (offline s3/sqs/kinesis/dynamodb-streams)#265
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Drop the removed @serverless/utils/log require; take {log} from the 3rd constructor arg via a new src/log.js shim (console fallback) and thread it into the S3 emulator.
- Replace removed serverless.cli.log with this.log.notice; fix log.warn -> log.warning.
- Remove dead _create/_s3Event methods and the now-orphaned s3-event-definition.js.
- Backward compatible with serverless v3 (peer kept wide). Adds docker-free unit tests. v7.1.0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ueName fixes - Serverless v4 logger migration (src/log.js shim threaded into the SQS emulator). - Fix undefined this.region -> this.options.region so emitted events carry awsRegion. Re-implements #166 (thanks @zlalvani). - Make SQS deleteMessageBatch entry Ids unique within a batch (index-based, <=80 chars). Re-implements #253 (thanks @flipscholtz). - Add custom.serverless-offline-sqs.queueName override (non-mutating; strips arn so it wins for arn-bearing shapes). Re-implements #211 (thanks @mfamilia). - Backward compatible with serverless v3. Adds docker-free unit tests. v8.1.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nt-def fixes - Serverless v4 logger migration (src/log.js shim threaded in; handler errors are now logged instead of silently swallowed). - Fix undefined this.region -> this.options.region so emitted events carry awsRegion. Re-implements #166 (thanks @zlalvani). - Replace the infinite silent handler retry with a bounded, logged retry (default maximumRetryAttempts=10, mirrors dynamodb-streams). Re-implements #100 (thanks @dolsem). - Await this.lambda.create(...). Re-implements #249 (thanks @gabsong). - Fix kinesis-event-definition omit list (tableName -> streamName copy-paste bug). - Backward compatible with serverless v3. Adds docker-free unit tests. v7.1.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…no-streams fixes - Serverless v4 logger migration (src/log.js shim threaded in; handler errors are now logged). - Fix undefined this.region -> this.options.region so emitted events carry awsRegion. Re-implements #166 (thanks @zlalvani). - Throw a clear 'Table <name> does not have streams enabled' error instead of failing cryptically. Re-implements #98 (thanks @dolsem). - Rename the copy-pasted KinesisEvent class to DynamodbStreamsEvent. - Backward compatible with serverless v3. Adds docker-free unit tests. v7.1.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
18852c0 to
ff500c6
Compare
1b687e8 to
df99a00
Compare
…fork), Node 22/24 Serverless Framework v4 requires a paid login for every command (incl. offline), so it can't run in CI. Switch the dev/test harness to osls — the Bref-maintained, MIT, license-free fork of Serverless Framework v3 with modern-Node support — via the alias serverless = npm:osls@^3.76.0 (satisfies serverless-offline's serverless peer and provides the sls bin). A root 'overrides' pins serverless-offline to 13.10.1 so the harness deterministically runs offline 13 on osls 3 (the plugins' wide >=11 peer would otherwise let npm resolve offline 14, which needs serverless 4); .npmrc legacy-peer-deps lets that install proceed. CI runs Node 22 + 24. Published plugins keep engines >=18 and wide peers (still support Serverless v3 AND v4). Drops unused harness deps (pump, signal-exit). Adds CHANGELOG.md crediting re-implemented community PRs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…+ batch/forbidden assertions Rewritten around a shared runOfflineTest helper: merge stdout+stderr, wait for readiness, detached process-group kill, distinct lambdaPort AND httpPort per config (no port races), hard timeout, and onReady rejection fails fast. Invocations are detected via a handler marker '__INVOKED__ <fn> <source> <count>' with a source id STABLE per (handler, source) so retries/splits dedupe. The helper asserts EXACT coverage of expectedKeys (a count threshold could let surplus markers mask a non-firing handler), hard-fails on forbiddenKeys with a drain window (catches the S3 prefix/suffix rule over-matching), and asserts expectBatch (the 70-message SQS batch is delivered batched, not one-per-invocation). EOL python3.7 handlers converted to JS and the orphaned handler.py removed (myPythonHandler renamed mySecondCallbackHandler). The autoCreate DLQ/Policy CFN-intrinsic fixture is removed (deferred #183). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
df99a00 to
e48e987
Compare
This was referenced Jun 20, 2026
Closed
This was referenced Jun 20, 2026
Closed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What & why
Serverless Framework v4 removed
@serverless/utils/logandserverless.cli.log. Our fourserverless-offline-*pluginsrequirethat module at load time, so they crash on everyslscommand under v4 (
sls package,sls offline, …). This PR migrates all four to the logger thatthe framework injects as the plugin constructor's 3rd argument (
{log}) — which has existedsince serverless v3.0, so the change is backward compatible with v3.
While we were in here owning this code, we also re-implemented the worthwhile ideas from several
long-open community PRs as our own, tested code, and fixed a batch of latent bugs the migration
surfaced.
Changes per package
All four — remove the dead
@serverless/utils/logrequire; take{log}from the 3rd ctor arg via anew
src/log.jsshim (full level set, console fallback); thread it into the emulator; replaceserverless.cli.log→this.log.notice. Minor version bump; peer kept^10.0.2 || >=11.log.warn→log.warning; delete dead_create/_s3Eventmethods and the now-orphaned
s3-event-definition.js.this.region→this.options.regionso events carry theright
awsRegion(fix: remove undefined reference tothis.region#166, thanks @zlalvani); uniquedeleteMessageBatchentry Ids within a batch(fix: SQS Delete Batch ID's should be distinct, which MessageID is not guaranteed to be #253, thanks @flipscholtz);
custom.serverless-offline-sqs.queueNameoverride (chore(serverless-offline-sqs): allow passing queueName from config #211, thanks@mfamilia).
awsRegionfix (fix: remove undefined reference tothis.region#166); replace the infinite silenthandler retry with a bounded, logged retry (default
maximumRetryAttempts: 10, mirrorsdynamodb-streams) (feat(offline-dynamodb-streams): add retries option #100, thanks @dolsem);
await lambda.create(...)(Fix module import bug #249, thanks @gabsong);fix
kinesis-event-definitionomit list (tableName→streamNamecopy-paste bug); now logs handler errors.awsRegionfix (fix: remove undefined reference tothis.region#166); clearTable <name> does not have streams enablederror (feat(offline-dynamodb-streams): table does not have streams error #98, thanks @dolsem); rename thecopy-pasted
KinesisEventclass toDynamodbStreamsEvent; now logs handler errors.Compatibility
{log}3rd arg exists in both; console fallback if absent).serverless-offline: ^10.0.2 || >=11) — services can migrate one at a time.Testing
npm run eslint(lint + Prettier) clean across the repo.Covers the log shim, the event mappers (with
awsRegionregression guards for fix: remove undefined reference tothis.region#166), thedelete-batch Id uniqueness (fix: SQS Delete Batch ID's should be distinct, which MessageID is not guaranteed to be #253), the non-mutating queueName override incl. arn-bearing shapes
(chore(serverless-offline-sqs): allow passing queueName from config #211), the kinesis omit-fix (discriminating test), and source-level call-site guards.
(
tests/serverless-plugins-integration, needs minio/elasticmq/kinesalite/dynamodb-local) and v4end-to-end (
sls package/offlineunderserverless@4, needsSERVERLESS_ACCESS_KEY). Therecommended CI v4 matrix is described in
docs/testing-and-ci.md.Tooling added
Repo docs under
docs/(architecture, conventions, testing-and-ci, publishing-and-versioning, thereview + triage, and per-task plans), plus a
serverless-plugin-devskill and aserverless-plugin-authoragent under.claude/to help future work on these plugins.Credits
Re-implements ideas from community PRs #166 (@zlalvani), #253 (@flipscholtz), #211
(@mfamilia), #98 & #100 (@dolsem), #249 (@gabsong) — thank you. 🙏
Follow-ups (not in this PR)
RedrivePolicyand start non-SQS lambdas, default to localhost #168 host/start — deferred until validatedagainst the Docker + v4 integration lane (see
docs/plans/07-deferred-and-closed-prs.md).🤖 Generated with Claude Code