Hi folks, I've followed this guide to start using ...
# help
j
Hi folks, I've followed this guide to start using Aurora in an app I'm building - https://serverless-stack.com/examples/how-to-use-postgresql-in-your-serverless-app.html. This uses the
data-api-client
npm package to handle the requests and connection to the DB. I'm getting some timeouts when using this -
Failed to send response because the Lambda function is disconnected
I'm wondering can I use the AWS SDK RDS Data Client package instead - https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-rds-data/index.html#aws-sdkclient-rds-data?
n
Following
I just started using aurora too and the package you mentioned there too. I'm not 100% sure but i would take a guess at that timeout which is happening is due to the db
autoPause
functionality where it pauses if it isn't being used (see more). And there is likely a startup time for the db which exceeds the lambda timeout length. I personally only notice the error you mentioned if i am running a function for the first time when debugging etc, and that shouldn't be an issue in prod etc since you would want to turn autopause off for those environments. But would be curious to know if you have noticed it in more places.
j
Thanks Noah. I've dug around a bit too and it looks like what you say is correct - lambda timeout length. I found this which backs up your idea - https://github.com/serverless-stack/serverless-stack/commit/f5a6f872d51e97f4b4928297212fcbfdb0bc1137 which was merged yesterday 😄 I'm only seeing it on
sst start
too, I'm new to SST and Aurora but if I see this issue happening elsewhere I'll let you know. Thanks.
f
Thanks @Noah D!
@thdxr what do you think we fire a dummy query (non blocking) on
sst start
to warm up the cluster? What’d be a good dummy query?
t
select 1
j
@Frank let’s turn this into an issue?
j
Thanks guys