build: stub optional aws-crt/aws-sdk to remove webpack build warnings#1141
build: stub optional aws-crt/aws-sdk to remove webpack build warnings#1141matthewhanson wants to merge 1 commit into
Conversation
stac-server builds emitted "Module not found: Can't resolve" warnings for optional AWS SDK deps that are never used at runtime: `aws-crt` (an optional native dependency) and `aws-sdk` v2 (the OpenSearch AwsSigv4Signer's fallback credential path — stac-server always supplies a v3 `getCredentials`). Stub both via `resolve.fallback` in every lambda webpack config so the build is clean. Closes #596. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses noisy webpack build warnings caused by optional AWS-related dependencies (aws-crt and aws-sdk v2) that are referenced by upstream libraries but not used by stac-server at runtime, by updating the lambda webpack configs to prevent webpack from emitting “Can’t resolve …” warnings.
Changes:
- Add
resolve.fallbackentries foraws-crtandaws-sdkacross all lambda webpack configs to suppress missing-module warnings. - Document the warning removal in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lambdas/webpack.config.js | Adds resolve.fallback for optional AWS modules in the lambda-dist bundle config. |
| src/lambdas/api/webpack.config.js | Adds resolve.fallback for optional AWS modules in the API lambda bundle config. |
| src/lambdas/ingest/webpack.config.js | Adds resolve.fallback for optional AWS modules in the ingest lambda bundle config. |
| src/lambdas/pre-hook/webpack.config.js | Adds resolve.fallback for optional AWS modules in the pre-hook lambda bundle config. |
| src/lambdas/post-hook/webpack.config.js | Adds resolve.fallback for optional AWS modules in the post-hook lambda bundle config. |
| CHANGELOG.md | Notes the removal of the “Can’t resolve” warnings via webpack config updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| devtool, | ||
| resolve: { | ||
| extensions: ["", ".webpack.js", ".web.js", ".ts", ".js"], | ||
| fallback: { 'aws-crt': false, 'aws-sdk': false }, |
| devtool, | ||
| resolve: { | ||
| extensions: ["", ".webpack.js", ".web.js", ".ts", ".js"], | ||
| fallback: { 'aws-crt': false, 'aws-sdk': false }, |
| devtool, | ||
| resolve: { | ||
| extensions: ["", ".webpack.js", ".web.js", ".ts", ".js"], | ||
| fallback: { 'aws-crt': false, 'aws-sdk': false }, |
| devtool, | ||
| resolve: { | ||
| extensions: ["", ".webpack.js", ".web.js", ".ts", ".js"], | ||
| fallback: { 'aws-crt': false, 'aws-sdk': false }, |
| devtool, | ||
| resolve: { | ||
| extensions: ["", ".webpack.js", ".web.js", ".ts", ".js"], | ||
| fallback: { 'aws-crt': false, 'aws-sdk': false }, |
|
Re: the review note that
So there's no runtime-semantics change in practice. Switching to |
Summary
Closes #596. The build emitted
Module not found: Can't resolve 'aws-crt'(and, after the AWS SDK v3 updates, the equivalentCan't resolve 'aws-sdk'from the OpenSearch client'sAwsSigv4Signer) — optional dependencies that stac-server never uses at runtime.Change
Add
resolve.fallback: { 'aws-crt': false, 'aws-sdk': false }to all five lambda webpack configs (api, ingest, pre-hook, post-hook, and the lambda-dist bundle). webpack then resolves these optional modules to empty instead of warning.Safe because:
aws-crtis an optional native dep the SDK probes for and gracefully does without.aws-sdk(v2) is only used byAwsSigv4Signerwhen nogetCredentialsis supplied — stac-server always supplies a v3defaultProvider()(database-client.ts), so that path is dead code.Verification
npm run buildgoes from 2 warnings to 1 — theaws-sdk/aws-crt"Can't resolve" warning is gone (aws-sdk (ignored)). The two remaining warnings (express/lib/view.js,keyv/src/index.js) are unrelated benign dynamic-require internals, out of scope for this issue.Closes #596
🤖 Generated with Claude Code