Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 07:42
    dragosmc commented #569
  • 02:28
    willfarrell closed #482
  • 02:28
    willfarrell commented #482
  • 02:24
    willfarrell closed #272
  • 02:24
    willfarrell commented #272
  • 02:24
    willfarrell commented #570
  • 02:20
    willfarrell commented #569
  • 02:19
    willfarrell commented #569
  • 02:13
    willfarrell commented #568
  • 01:59
    willfarrell commented #567
  • 01:54
    willfarrell commented #566
  • 01:54
    willfarrell commented #565
  • Oct 19 22:09
    dragosmc edited #569
  • Oct 19 22:06
    dragosmc opened #570
  • Oct 19 13:54
    dragosmc edited #569
  • Oct 19 13:50
    dragosmc edited #569
  • Oct 19 13:47
    dragosmc opened #569
  • Oct 19 06:20
    gpoole opened #568
  • Oct 15 10:45
    bokjo commented #567
  • Oct 15 10:45
    bokjo commented #567
Thomas Edwards
@thomasedwards
this bumps up my file size from less than 1MB to 3.5MB
Thomas Edwards
@thomasedwards
done some digging and opened an issue: middyjs/middy#154
Luciano Mammino
@lmammino
Hello @thomasedwards , thanks a million for your contribution and sorry for the long wait, i was away for a conference :)
looking into your issue right now
Thomas Edwards
@thomasedwards
thank you! =)
have closed it, will investigate further
Thomas Edwards
@thomasedwards
also ā€“ any thoughts about giving more information from the validator? middyjs/middy#155
I have now realised that actually just editing the validator to pass the errors through as a string
rather than using 'Event object failed validation' would be possibly safer
Luciano Mammino
@lmammino
@thomasedwards thank you for pointing that out. I am currently slowly going over all the open issues an PR in my free time. I will try to address everything later this evening
Thomas Edwards
@thomasedwards
no worries! let me know if there's anything I can do to help
have replied to your comments, thanks @lmammino ! middyjs/middy#155
Thomas Edwards
@thomasedwards
Super loving 0.12 :thumbsup: Sooo much easier to debug now with the beautiful extreme logging ā€“ thanks team! :heart:
Thomas Edwards
@thomasedwards
Okay, I think I have a really tricky problem...
In one of my middlewares I have a promise that needs to return before it can continue
however, if I add async/await to the function, I get a whole load of errors and pain
Thomas Edwards
@thomasedwards
okay I found a way
Iā€™m returning a promise to a variable set in the middleware
I don't do any async/await in the middleware
but then I await it when I use it later on
Andrea Falzetti
@rexromae_twitter
@vladgolubev hey mate, I'm trying to understand why the change that I've done to the docs, it's still not showing in the website. Did I miss any step?
Dan Van Brunt
@iDVB
HELP! Love Middy so far. Having an issue with writing jest tests with my custom middleware written with async/await. My middleware has a proper try/catch around the await. I've looked at the ssm middleware that is part of the core for ideas. My middleware works fine when I remove that single async call to S3. But with it I keep getting UnhandledPromiseRejectionWarning
Is there some special way to implement a middleware that uses async/await
Dan Van Brunt
@iDVB
@lmammino Would love if you have a moment to chime in on this. middyjs/middy#270 Seems like a current limitation when trying to test custom middleware.
F. Kiss
@filipekiss
Hey people, quick question: Does any one have an example of what type arguments Middy expects? The argument names aren't quite descriptive and I have no idea what I should pass to Middy<T, R, C> except for C because it extends Context
will Farrell
@willfarrell
I'm going to be in London for 2 weeks over christmas if anyone wants to get a pint and talk shop.
Sam Koucha
@ElectroMW
0/
will Farrell
@willfarrell
There is a bunch of typescript issues in the backlog, anyone willing to triage and maybe submit PR's for them. I don't use typescript, so can't help here.
Thomas Edwards
@thomasedwards
Aww man I missed the Christmas meetup
will Farrell
@willfarrell
You didn't miss anything, no meetup happened. No FOMO here.
If anyone is in Calgary, be sure to hit me up.
Yoni Braslaver
@JoniBR
Hi, I have an issue where I throw an error object in one of the middlewares but on the onError function handler.error only holds the object.message property. any way to access the full object on the onError?
will Farrell
@willfarrell
Has anyone played around with Streaming json from lambda to oboejs or similar? Having trouble finding it in the documentation, is it called StreamingBody?
Alper Necati Akin
@alpernakin
Hello folk!
Does anybody know how to assign error message for validation on input schema object?
will Farrell
@willfarrell
Check out https://github.com/epoberezkin/ajv-errors, might be what you're looking for.
will Farrell
@willfarrell
We made the news. The top story in Node Weekly https://nodeweekly.com/issues/336
will Farrell
@willfarrell
will Farrell
@willfarrell
and serverless weekly: https://serverless.email/issues/148 really making the rounds.
Callum Evans
@callumevans

Hey all! Is there any preferred way of reusing a configured set of middlewares?

I have a handler configured:

const handler = middy(async (event, context, callback) => {
    (...)
    callback(null, { });
});

handler.use(middleware1())
handler.use(middleware2())
handler.use(middleware3())
handler.use(middleware4())

module.exports = { handler };

I'm looking for a good way of only having to specify something like:

const handler = withMiddlewares(async (event, context, callback) => {
    (...)
    callback(null, { });
});

module.exports = { handler };

Where the handler is pre-configured with a bunch of middlewares.

I'm trying to avoid duplicating a bunch of handler configurations that are all going to be the same / similar.

Cheers!

Luciano Mammino
@lmammino
Hey @callumevans, .use() also supports array of middlewares. If I understand your question, that might help you to simplify reusing pre-configured middlewares across handlers
Andrey Alyabyev
@nodeleaks
Hi everyone! Is it possible to trigger middleware by another middleware? Help please with example
will Farrell
@willfarrell
Can you describe your use case in more detail? All middlewares get triggered, if you wanted to disable/enable one based on the context you would have to write your own wrapper to handle that.
Andrey Alyabyev
@nodeleaks
I found that return handler.callback() stops function's execution immediately and return next() just stop middleware execution. Thats what I need
Linus Probert
@LiquidityC
Hi guys. I've working on a api call where the caller needs to provide either "department" or "email" eg. one has to be present but not both. Does middy have support for such a scenario? Before you ask, no, I can't change it (which obviously might be better)
will Farrell
@willfarrell
@LiquidityC when using the validator middleware (which uses ajv) depends on JSON Schema which supports that. Checkout oneOf in the spec.
Linus Probert
@LiquidityC
@willfarrell Will do, thanks man!
Erick Peniche
@erickpeniche
Hi! I'm having some issues while working with middy and httpErrorHandler middleware. I am using AWS Lambdas through an API Gateway, I have wrapped my handler in a middy() function and also applied the middlewares with .use(). When I need to throw an error inside my Lambda handler, I use the createError method from the http-errors library. But for some reason, the lambda response is always a 502 with {"message": "Internal server error"}. Am I missing something?
will Farrell
@willfarrell
The httpErrorHandler should be the last middleware in the chain. Can't really help more without seeing the full example. Maybe post an issue in the repo.
David Vasandani
@davidvasandani
Is it possible to run middy-reroute locally for testing?