-
Notifications
You must be signed in to change notification settings - Fork 283
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
feature: Make logger support async calls #425
Conversation
@igalklebanov Is this really a breaking change? Won't all the old code work with this change, or am I missing something? |
Hey 👋 Thank you! 🙏
Best practice in AWS lambda is to manage connections/pools in global context (outside of your handler function scope). This way pools stay open as long as the lambda instance is up (can even last for 2-3 hours if it keeps getting requests).
https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html This'll also remove the need to use
Have you tried using something like Lumigo? You can group errors together and configure alerts that can be sent to Slack. |
You're right, it's not. My bad. |
Just looked into RDS Proxy - we'll likely go with it. Coming from MongoDB Atlas, we weren't aware of this. Thanks!
We had tried Sentry way back before. To say the least, in our experience at least it caused more problems than it solved (we traced back a very subtle bug with Sentry somewhere that crashed 1 in 100 requests with a 502 status code randomly). Removing sentry fixed it. We currently have AWS X ray enabled with Cloudwatch - but would probably go with DB query errors manually for now (hence the PR). Thanks for the quick approval and useful insights! |
We use kysely on AWS lambdas (serverless) with
context.callbackWaitsForEmptyEventLoop = false
option. This helps us keep DB connection pool opened in background when lambda gets reused by AWS.We want to log specific errors and immediately inform us over Slack if something unexpected happens with a specific query/error. We can setup a pipeline via Cloudwatch/lambda triggers however the use-case can also work for us if
log
function insideKysely
class can beawaited
by Kysely internally.The reason we cannot use
.then()
inside the logger function for making async network requests is because we run withcallbackWaitsForEmptyEventLoop = false
option where AWS freezes lambda the moment the callback is complete (which will happen unless kysely internallyawaits
the logger to return)Please let me know if this needs any clarification