dougmoscrop / serverless-http

Use your existing middleware framework (e.g. Express, Koa) in AWS Lambda 🎉
Other
1.73k stars 167 forks source link

3.0 breaking changes? #233

Open memark opened 2 years ago

memark commented 2 years ago

Where can I find release notes for 3.0? Specifically I'd like to know about any breaking changes.

Sparticuz commented 2 years ago

In looking at the commits, I don't personally see anything breaking. @dougmoscrop might have wanted a version bump for the Azure compatibility?

dougmoscrop commented 2 years ago

I merged a bunch of older contributor PRs, some that had no tests, and out of caution I didn't want people to pull in those changes (without review). The integration tests I wrote still passed.

I also dropped support (per engines stanza) for node 8 and 10.

agawley commented 2 years ago

I noticed that the return type of the handler changed from

 export type Handler = (
    event: AWSLambda.APIGatewayProxyEvent | AWSLambda.APIGatewayProxyEventV2,
    context: AWSLambda.Context
  ) => Promise<AWSLambda.APIGatewayProxyResult | AWSLambda.APIGatewayProxyStructuredResultV2>;

to

export type Handler = (
    event: Object,
    context: Object
  ) => Promise<Object>;

Should we be casting now? Feels like a bit of a regression from a type safety perspective.

dougmoscrop commented 2 years ago

The intended use of this library is to be exported from a module that is being dynamically imported by a hosting provider at runtime, simply wrapping an existing application - honestly I don't think there really was type safety to begin with and I don't see a lot of value in maintaining it, save for making options a bit clearer.

For example, that above original signature is saying that you can give it either type of event and get back either type of response? Well that doesn't make sense, if you give it a V2, you would expect V2 back, so I guess it should be rewritten as a composite type of several kinds of handlers with explicit in/out

export type Handler = APIGatewayProxyHandler | ApiGatewayRestApiHandler | APIGatewayProxyV2Handler | AzureHandler

but then you'd still have to cast and it still doesn't change the fact that the actual runtime arguments are going to be controlled by a completely separate configuration in your IaC template

agawley commented 2 years ago

Fair point. Thanks for the info.

shellscape commented 2 years ago

Can we at least get a CHANGELOG or entries in Releases?

Zeikko commented 1 year ago

I would appreciate some kind of Changelog and list of breaking changes in the future. Thanks for all the work regardless!