Functions Middleware?

Really like functions, yet I’m wondering if there is a feature for middleware that we can enable for all functions (or just in a certain directory).

Serverless auth or uniform error handling would be much improved that way.

Alternatives I’m considering on how to add/simulate such a kind of serverless pipeline:
a) ‘import’ all needed “general functions” in each serverless function

b) using something like apollo server (lambda) in a “main serverless function” and make other calls from there, but execution time might be an issue with that approach

Hey there, @MentalGear :wave:

Thanks so much for your patience here. My apologies for the delayed response. I have looped in our Support Engineers and hope to have an answer for you soon.

Best,
Hillary

hey Mentalgear, thanks for reaching out.

I talked to some support engineers about your use case and unfortunately there isn’t really a stock or pre-fab way of doing what you are describing. That said, there is no reason why you couldn’t create something like this yourself!

Thx for your feedback. I came to the conclusion to use apollo server (lamdba) for this !

2 Likes

sounds good! let us know if you have any major learning moments in this, as that might be interesting for other folks.

1 Like

Got Apollo Server Lambda (which can serve as a middleware) running on Netlify functions. You can find my full example here: Minimal Reproducible Example: Netlify dev debug w/VS code (running Apollo Server Lambda)
@hillary @perry

2 Likes

awesome! thanks for sharing!