powertools-lambda-typescript icon indicating copy to clipboard operation
powertools-lambda-typescript copied to clipboard

Bug: Peer Dependency Conflict with `@middy/core` in Version 1.13.0

Open domengabrovsek opened this issue 3 years ago • 9 comments

Expected Behaviour

This issue forces us to pin the logger version to 1.12.1 to avoid the build failure. It would be great if the peer dependencies could be aligned to support the latest versions of both packages.

npm install should complete without errors.

Current Behaviour

Up until now, I was using @aws-lambda-powertools/logger version ^1.12.1 and @middy/core version ^4.5.5 in my package.json. Since version 1.13.0 was released, my npm install fails with this error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @aws-lambda-powertools/[email protected]
npm ERR! Found: @middy/[email protected]
npm ERR! node_modules/@middy/core
npm ERR!   @middy/core@"^4.5.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @middy/core@">=3.x <4.x" from @aws-lambda-powertools/[email protected]
npm ERR! node_modules/@aws-lambda-powertools/logger
npm ERR!   @aws-lambda-powertools/logger@"^1.12.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @middy/[email protected]
npm ERR! node_modules/@middy/core
npm ERR!   peerOptional @middy/core@">=3.x <4.x" from @aws-lambda-powertools/[email protected]
npm ERR!   node_modules/@aws-lambda-powertools/logger
npm ERR!     @aws-lambda-powertools/logger@"^1.12.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/domengabrovsek/.npm/_logs/2023-09-21T08_42_49_919Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/domengabrovsek/.npm/_logs/2023-09-21T08_42_49_919Z-debug-0.log

Upgrading to @aws-lambda-powertools/[email protected] breaks the build due to a peer dependency conflict with @middy/core.

Code snippet

not applicable

Steps to Reproduce

  1. Have the following package.json in your project:
    {
      "dependencies": {
        "@aws-lambda-powertools/logger": "^1.12.1",
        "@middy/core": "^4.5.5"
      }
    }
    
  2. Run npm install

OR

clone this repo https://github.com/domengabrovsek/aws-powertools-repro and run npm install

Possible Solution

No response

Powertools for AWS Lambda (TypeScript) version

1.13.0

AWS Lambda function runtime

18.x

Packaging format used

npm

Execution logs

No response

domengabrovsek avatar Sep 21 '23 08:09 domengabrovsek

Thanks for opening your first issue here! We'll come back to you as soon as we can. In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

boring-cyborg[bot] avatar Sep 21 '23 08:09 boring-cyborg[bot]

Hey @domengabrovsek thanks for raising the issue and apologies for the failed build caused by the new version.

We only support middy 3.x, and added only recently the peer dependency to make it explicit. As mentioned in #1694 we are very close to drop node14 support and can start moving to middy 4.x. in our major v2 release.

am29d avatar Sep 21 '23 09:09 am29d

Thank you @am29d for the explanation.

It surprised me because the build started failing without any changes on my side and I didn't notice any breaking changes related to this. I have been using tracer, logger, and metrics with middy 4.x for some time now and it has worked well. I'll pin the versions for now so I can continue working.

Thank you for everything you're doing with the powertools, it's a pleasure to use them!

domengabrovsek avatar Sep 21 '23 09:09 domengabrovsek

Hi @domengabrovsek, thank you for opening this issue. As Alex mentioned this is something that was already documented both our documentation(see callout titled "A note about Middy") and Middy's documentation (here), however we should not have made this change in a minor release like we did.

We will make another emergency release today and remove the peer dependency. Then we'll revisit the topic in our next major version.

dreamorosi avatar Sep 21 '23 09:09 dreamorosi

Hey @domengabrovsek , it was great that it worked with 4.x before 😄 .

@dreamorosi and I had a chat and we agreed that it'd be best to remove the upper bound on middy 4.x to unblock you and potentially many others. I will make a quick release soon.

Thanks again for raising this issue, which helps us to address breaking builds quickly 🙏.

am29d avatar Sep 21 '23 09:09 am29d

Thank you @am29d and @dreamorosi for such a fast response! 🙏

domengabrovsek avatar Sep 21 '23 09:09 domengabrovsek

This is pretty wholesome, how you guys have responded so rapidly and even offered to help the community with a new release. :)

alenkoso avatar Sep 21 '23 09:09 alenkoso

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Sep 21 '23 10:09 github-actions[bot]

This is now released under v1.13.1 version!

github-actions[bot] avatar Sep 21 '23 11:09 github-actions[bot]