jeremydaly / jeremydaly/lambda-api

Could not resolve "@aws-sdk/client-s3"

Open Beginner friendly
#356 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.5k
Forks
127
Avg merge
31m
Merged PRs (30d)
2

Description

Issue

@aws-sdk/client-s3 peerDependency range out of sync with devDependency

Our team encountered this error after bumping lambda-api to the latest version. The same issue did not occur with @aws-sdk/s3-request-presigner, which has consistent versions across peer and dev dependencies.

✘ [ERROR] Could not resolve "@aws-sdk/client-s3"

    ../node_modules/lambda-api/dist/esm/lib/s3-service.js:19:42:
      19 │         const { S3Client } = await import('@aws-sdk/client-s3');
         ╵                                           ~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@aws-sdk/client-s3" as external to exclude it from the bundle, which will
  remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to
  handle this failure at run-time instead of bundle-time.

1 error
npm error Lifecycle script `build` failed with error:
npm error code 1
npm error path /Users/aichi.chang/krakenflex/schedules/schedules-api
npm error workspace schedules-api@1.0.0
npm error location /Users/aichi.chang/krakenflex/schedules/schedules-api
npm error command failed

peerDependencies declares @aws-sdk/client-s3: "^3.470.0" but devDependencies pins 3.1106.0. Since the library is developed and tested against 3.1106.0, consumers constrained to ^3.470.0 may hit runtime or build failures. @aws-sdk/s3-request-presigner is at 3.470.0 in both — which is why only client-s3 is affected.

Would it be possible to bump the @aws-sdk/client-s3 peerDependency to "^3.1106.0"?

Environment

npm: 10
node: 22

Workaround

We made @aws-sdk/client-s3 as an external package in the build command resolves the error, but feels like a workaround rather than a proper fix.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the package manifest entries for the @aws-sdk/client-s3 peerDependency and devDependency, then compare them with the matching @aws-sdk/s3-request-presigner versions. Update the client-s3 peer range to match the tested dependency and run the npm build that currently fails; done means the dependency declarations are consistent and the build resolves the package.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
backend, build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.