Skip to content

Conversation

@coderbyheart
Copy link
Contributor

@coderbyheart coderbyheart commented Jan 6, 2026

See https://github.com/middyjs/middy/releases/tag/7.0.0

Closes #4920

Summary

This adds @middy/core@v7 as an allowed peer dependency.

Ideally we also bump the min. Node.js version to 22, but since AWS lambda still supports Node.js 20 until July 2026 1 I opted not to introduce this breaking change.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Footnotes

  1. https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html

@boring-cyborg
Copy link

boring-cyborg bot commented Jan 6, 2026

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@boring-cyborg boring-cyborg bot added the dependencies Changes that touch dependencies, e.g. Dependabot, etc. label Jan 6, 2026
@pull-request-size pull-request-size bot added the size/S PR between 10-29 LOC label Jan 6, 2026
@svozza
Copy link
Contributor

svozza commented Jan 6, 2026

Thank you for the PR. As you can see, one of the GitHub checks is failing. Could you please create an issue for this and link to it in your PR?

@coderbyheart
Copy link
Contributor Author

@svozza Done!

@dreamorosi dreamorosi added the do-not-merge This item should not be merged label Jan 6, 2026
@dreamorosi
Copy link
Contributor

Before we can merge this we need to add this new version to the test matrix in the e2e tests. I don't remember if we have dropped support for an older version of Middy.js yet, but we should keep only versions that align with Node.js 20, 22, and 24.

Once we have Middy.js in our test suite and it's passing, we can merge this.

@svozza
Copy link
Contributor

svozza commented Jan 6, 2026

Yes, I've been looking at the E2E tests and it looks like we are currently only running them against Middy v5 for most tests.

@coderbyheart
Copy link
Contributor Author

Makes sense. I dug a bit into it, and from what I understand how it could be achieved that the lambda test function is bundled with the @middy/core version that is specified in the build matrix is through an esbuild plug-in that influences how esbuild resolves the @middy/core peer dependency at build time.

@dreamorosi
Copy link
Contributor

We don't use any esbuild plugin, the NodejsFunction CDK construct that we use in this project doesn't support them.

We just have a number of Middy.js versions installed under different aliases, and import one or the other using that alias.

I think we should look at Middy.js release notes, figure out which one maps with each Node.js version, and remove the ones for versions older than 20 (if any).

As long as we have 1-2 test fixtures with v7 I think that's enough for now.

@svozza
Copy link
Contributor

svozza commented Jan 6, 2026

It looks like Middy 4 targeted Node 18, so we could remove that and replace with v7: https://middy.js.org/docs/upgrade/4-5. We don't have any Middy 4 tests so we'll need to move some of the v5 tests to v7.

@svozza
Copy link
Contributor

svozza commented Jan 6, 2026

The Tracer tests might make sense, because that means we would have Logger -> v5, Idempotency -> v6, and Tracer -> v7:

That said, there's only one Middy test in that utility so we might want to change one of the logger ones too, to give a bit more coverage.

@dreamorosi
Copy link
Contributor

I'm ok to remove Middy.js v4, my preference would be to add v7 to the Idempotency tests since most of the v7 changes are related to Durable Functions, which we also made changes for in that module.

With that said, I don't expect breaking changes so either works.

@boring-cyborg boring-cyborg bot added the tests PRs that add or change tests label Jan 6, 2026
@coderbyheart
Copy link
Contributor Author

Added middy v7 and bumped all alias to respective latest version.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 2026

@svozza
Copy link
Contributor

svozza commented Jan 6, 2026

I've ran the E2E tests and the idempotency ones are passing. However, I've realised that this means we now have no coverage of Middy v6 now. I propose we change two of the tests in the Logging utility to use v6 instead of v5.

@coderbyheart
Copy link
Contributor Author

coderbyheart commented Jan 6, 2026

@svozza
Copy link
Contributor

svozza commented Jan 6, 2026

Ah I missed that. Great stuff!

@dreamorosi dreamorosi removed the do-not-merge This item should not be merged label Jan 6, 2026
@svozza svozza merged commit 74bf4c6 into aws-powertools:main Jan 6, 2026
47 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 6, 2026

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

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

Labels

dependencies Changes that touch dependencies, e.g. Dependabot, etc. size/S PR between 10-29 LOC tests PRs that add or change tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Support @middy/core v7

3 participants