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 2 #585

Closed
63 tasks done
willfarrell opened this issue Dec 16, 2020 · 19 comments
Closed
63 tasks done

Version 2 #585

willfarrell opened this issue Dec 16, 2020 · 19 comments

Comments

@willfarrell
Copy link
Member

willfarrell commented Dec 16, 2020

See /docs/CHAGNELOG.md & /docs/UPGRADE.md on release/2.x for what has changed.

TODO / Ideas

If anyone has comments, suggestions, or must-have features. Please post them here.

Documentation

Missing / Blocked

Testing

Dependencies

Observations

  • core npm size 38.4kb -> 12.8kb
  • cold start times decrease by up to 20%
@willfarrell willfarrell added this to the v2.0.0 milestone Dec 16, 2020
@willfarrell willfarrell self-assigned this Dec 16, 2020
@willfarrell willfarrell pinned this issue Dec 29, 2020
@baileytincher
Copy link
Contributor

Can we rename the generics in the core declarations file? https://github.com/willfarrell/middy/blob/c5464931349a81bad412c52588a1245acb88b39e/packages/core/index.d.ts#L28

Instead of T, R, C we can go to something more descriptive like TEvent, TContext, TCallback?

Would this break backwards compatibility with anything? (I don't think it would)

@willfarrell
Copy link
Member Author

willfarrell commented Dec 30, 2020

v2 is going to be a breaking change. I think this is a great opportunity to make the names more descriptive.

@willfarrell
Copy link
Member Author

After some reflection and discussion with others, I've decided to roll back to using aws-sdk v2 over v3. v3 just isn't as mature as it should be as flagged by the issues above. I'm confident AWS will address these open issues, but there is no guarantee they will in the near term.

@willfarrell willfarrell mentioned this issue Jan 3, 2021
2 tasks
@willfarrell
Copy link
Member Author

The profiler has been removed as a requirement for v2 alpha. Opening up for discussion on the best approach #599

@prisis
Copy link

prisis commented Jan 5, 2021

Hey :), do you know when the first v2 alpha will be released?

@willfarrell
Copy link
Member Author

willfarrell commented Jan 5, 2021

Thanks for the question @prisis. It's mostly there right now. @lmammino and I are have a discussion scheduled to resolve some of the outstanding issues, and potentially breaking changes to the current branch. I may release the first alpha without TS support (the biggest missing piece), just to get it out there and start IRL testing. I'll have a better idea next week, but could be as early as the end of the month. I will post here when a published alpha is ready for other the download and test.

@willfarrell
Copy link
Member Author

After some reflection and discussion with @lmammino. ESM support will be remove from this version. This will decrease the barrier to upgrade and reduce the complexity of packaging. We will consider adding this back in based on community feedback and broader adoption around esm.

@prisis
Copy link

prisis commented Jan 14, 2021

Did you try developit/microbundle for bundling all the packages?

@willfarrell
Copy link
Member Author

I'm not familiar with this one specifically. But am with others. This approach makes more sense when you expect the package to be included in the browser and you want every flavour or packaging to fix your needs. On nodejs, providing multiple can over complicate the documentation and over all developer experience.

By only supporting commonjs both const middy = require('@middy/core') and import middy from '@middy/core' work based on the context they're imported into. No file paths necessary.

This also keeps maintenance cost low.

@ghostd
Copy link

ghostd commented Jan 17, 2021

Hi,

I'm just discovering this project (which seems awesome). Do you plan to write some documentation for beginners? Something like 'how to run your lambda on your local machine?' or 'how to write a simple test with middy?'

Cheers

@willfarrell
Copy link
Member Author

willfarrell commented Jan 17, 2021

@ghostd We're always looking to improve out documentation for those just getting started. However we can't document everything. Keeping the focused on Middy ensures we're not wasting valuable resources where others are already covering well.

how to run your lambda on your local machine?: Checkout serverless-offline
how to write a simple test with middy?: Checkout any of the test files in this project. v1 uses jest, v2 uses ava + sinon

@prisis
Copy link

prisis commented Jan 19, 2021

@ghostd 
how to run your lambda on your local machine?: install npmjs.com/package/express, https://www.npmjs.com/package/cors and npmjs.com/package/lambda-local

create a lambda-server.js file and then run it with node ./lambda-server.js

const path = require("path")
const express = require("express")
const lambdaLocal = require("lambda-local")
const cors = require("cors")

const app = express()

app.use(express.text())
app.use(cors())

app.use("/{your url}", async (req, res) => {
    const result = await lambdaLocal.execute({
        lambdaPath: path.join(__dirname, "dist", "index.js"),
        lambdaHandler: "handler",
        envfile: path.join(__dirname, ".env"),
        event: {
            headers: req.headers, // Pass on request headers
            body: req.body, // Pass on request body
            queryStringParameters: req.query,
        },
        timeoutMs: 5000,
    })

    // Respond to HTTP request
    res.status(result.statusCode).set(result.headers).end(result.body)
})

app.listen(3000, () => console.log("listening on port: 3000"))

@ghostd
Copy link

ghostd commented Jan 19, 2021

@prisis Nice snippet, thanks!

@willfarrell
Copy link
Member Author

Alpha has been released. Now on npm.

@nfantone
Copy link
Contributor

@willfarrell Good stuff! Anywhere we could gather some release notes on what was added/changed apart from the checklist on this issue?

@willfarrell
Copy link
Member Author

You bet. See /docs/CHAGNELOG.md for high level & /docs/UPGRADE.md for the granular details on release/2.x for what has changed.

@willfarrell
Copy link
Member Author

TypeScript definitions will be merged soon. Expect a beta release in the coming days!

@HassanMahmud
Copy link
Contributor

Would you consider V2 production ready?

@willfarrell
Copy link
Member Author

willfarrell commented Mar 21, 2021

Yes, myself and others been using it in production since the first alpha release in January. We're planning when the stable release will happen soon, we hope to lock down a date next week.

@willfarrell willfarrell unpinned this issue Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants