Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 5 #940

Closed
27 of 34 tasks
willfarrell opened this issue Nov 19, 2022 · 7 comments · Fixed by #1134
Closed
27 of 34 tasks

Version 5 #940

willfarrell opened this issue Nov 19, 2022 · 7 comments · Fixed by #1134
Assignees

Comments

@willfarrell
Copy link
Member

willfarrell commented Nov 19, 2022

aka "The ESM Only Update"

Alpha: May/June (after initial nodejs release)
Beta: Sept/Oct
Release: Nov (after nodejs active LTS starts)

  • Timelines based on AWS nodejs20.x release cycle

Planned

  • Drop Node v16, Add support fro Node v20 (Node v20 Released aws/aws-lambda-base-images#91)
  • Drop CJS support, ESM only (do last, touch base with Powertools team before, they still use cjs)
  • TypeScript Update TypeScript improvements - what should we address? #1023
  • event-normalizer: review for any new events from AWS docs and event list
  • http-security-headers: review against helmet, MDN, ASVS
  • Update all custom error messages to follow same error pattern. {cause:{package:'@middy/*****', ...}}
  • http-multipart-body-parser change disableContentTypeError to false by default
  • http-urlencoded-body-parser change disableContentTypeError to false by default
  • http-json-body-parser change disableContentTypeError to false by default
  • http-cors change disableBeforePreflightResponse to false by default
  • s3-object-response update to use fetch over https
  • ws-json-body-parser deprecate rawBody from event
  • store preferred* in context instead of event for http-content-negotiation
  • error-logger pass in context with request.error

Polyfills

>= 17

>= 18

  • update to use fetch over https

>= 19

>= 20

New Middleware?

Maybe

Next Version

  • Update abort signals if Lambda adds support
  • Routers updated to support URLPattern? No, still experimental
  • http-urlencode-body-parser rename to http-urlencoded-body-parser? Nah
@KillDozerX2
Copy link
Contributor

Either you're moving too fast to I'm too slow. I just switched to node16 today and saw this.
Anyways, keep up the good work guys!

@willfarrell
Copy link
Member Author

@KillDozerX2 lol, neither. AWS released two nodejs runtimes this year, nodejs16.x later than expected and nodejs18 way earlier than expected. I'm hopeful we'll get nodejs20.x by late fall next year. We follow the runtime release cycle for major releases, so lots of time till the next version. I create a draft of the next release to capture everything that didn't make it into the current release so it doesn't get lost.

@dave-irvine
Copy link
Contributor

Can I 👎 on Drop CJS support, ESM only?.

I cannot describe the pain I have gone through trying to use node-fetch in ESM-only mode, I had to drop down to their previous major release. I cannot make ESM-only work with esbuild no matter what I try.

node-fetch/node-fetch#1263 describes a litany of issues people are facing.

Just my 2 cents, I can understand wanting to move forward.

@willfarrell
Copy link
Member Author

Thanks for the feedback. It's just an idea right now. FYI fetch is built into NodeJS 18, finally no more polyfill is needed.

This is the esbuild script I use, if you'd like to give it a try:

node_modules/.bin/esbuild ${1} \
		--platform=node --format=esm  --target=node18 --bundle --minify \
		--banner:js="import { createRequire } from 'module';const require = (m) => { if (m === './reserved.js') return {}; return createRequire(import.meta.url)(m);};const __dirname='.';" \
		--legal-comments=external --sourcemap=external \
		--allow-overwrite --outfile=${1%.js}.mjs

@olanb7
Copy link

olanb7 commented Mar 13, 2023

Integration with aws-lambda-powertools would be a nice add. It's not much, but we're currently enriching the logger in middleware:

export const LoggerMiddleware = (logger: Logger): middy.MiddlewareObj => {

  const before: middy.MiddlewareFn = async (request: middy.Request): Promise<void> => {
    logger.addContext(request.context);
    logger.addPersistentLogAttributes({
      service: request.context.functionName,
      ...getIdentityAttributes(request),
    });
    
    ...

@willfarrell
Copy link
Member Author

@olanb7 Powertool already has a Middy middleware for their logger. See https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/#capturing-lambda-context-info, might be of use to you.

@willfarrell willfarrell changed the title Version 5 [Draft] Version 5 Oct 30, 2023
@willfarrell
Copy link
Member Author

5.0.0-rc.0 is now released.

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

Successfully merging a pull request may close this issue.

4 participants