Hello everyone. Just for info I am using RDS(Postg...
# help
m
Hello everyone. Just for info I am using RDS(Postgres) with my SST for the backend. My SST version is "0.65.6". I am having an issue with:
Copy code
Failed to send response because the lambda function is disconnected
How it happens: • I send API request to my API • API recognizes the request and triggers the right lambda • lambda starts doing its work, parses in the data from the request body, sends the query to the RDS etc.. • I receive the Internal Server Error, 500 as response to my request • SST send me the above message ("Failed to send response because the lambda function is disconnected") • SST prints out the "real" response Message in the console, (200, body of a successful request*) What I think is the problem: My lambda function doesn't wait for the Response from the DB before sending it back to the client. So my question is, how do I make my lambda functions pre-connect to the RDS and wait out for the response?
r
You can pass --increase-timeout to sst start
m
Hey @Ross Coundon thank you for the response, but I already knew that I said to my self that I will use it as a last resort 😄. I am looking for an optimal solution here, that won't consume more resources.
r
I'm not sure there's much else you can do, the max timeout for api gateway is a limiting factor at 30s
t
This might be related to a bug that we fixed in 1.0
actually never mind, you just need to set RDS not to scale to zero
in production you probably never want that
for local development it's fine to scale to 0
m
So what are you advising @thdxr?
t
hm actually I think by default we don't scale to 0
the example is probably what you want
m
So to never pause the DB?
t
yeah for prod
but autopausing is good for local development, you don't want it running when you're not around
m
Okay @thdxr thanks, will try it out now. Will report back the results.
There seems to be a problem @thdxr , I tried to use the link that you have sent me, and I am getting this error now:
t
@Frank is this a bug possibly?
m
@thdxr I'll try updating to newest version of SST and try again
f
@Meris Tarhanis @thdxr lemme take a look..
@Meris Tarhanis I was not able to reproduce ur issue.
The RDS is defined similar to the screenshot you shared https://github.com/fwang/sst-triage-rds-autopause/blob/main/stacks/MyStack.js#L7-L13
Can u follow the steps in the README and see if you can build this app?
Leaving a note here,
autoPause
was set to
process.env.AUTO_PAUSE
which has a string value ie.
"true"
, changing it to
process.env.AUTO_PAUSE === "true"
worked.