Skip to content

Conversation

@caaarlxs
Copy link

Context: When using Serverless Framework v4 (or packaging with warmup patterns that only include .warmup/**), the generated warmup handler imports @smithy/node-http-handler (and @aws-sdk/client-lambda) but the warmer artifact does not include node_modules, causing runtime ERR_MODULE_NOT_FOUND.

Root cause: The plugin’s default packaging pattern excludes node_modules, but the generated handler depends on external modules.

Change: After writing .warmup//index.mjs, bundle it with esbuild into a self-contained ESM file and replace the original index.mjs.

Result: The warmer artifact remains minimal and works without requiring users to manually include node_modules patterns; fixes missing module errors for @smithy/*.

Verification:

  • serverless package produces a warmup zip containing only .warmup/**/index.mjs
  • Deployed warmer runs successfully (no ERR_MODULE_NOT_FOUND)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant