Feature request: be able to deploy a single functi...
# sst
d
Feature request: be able to deploy a single function at a time. Also, be able to deploy a single direct lambda function that lives within appsync too. Similar to this; https://www.serverless.com/framework/docs/providers/aws/cli-reference/deploy-function/
t
Terraform has a feature where instead of applying the whole config, you can set the a specific resource with a
target
flag. I did use this once in a while. I'm not sure if that's entirely possible with how CDK works
Can you describe a bit more about how you'd use this feature?
d
Yeah. Here’s what I’m experiencing. Local debugging is actually a bit flaky for me and I’m not able to use it consistently, so I would like a faster way to deploy changes. Right now, updating the appsync stack takes about 160 seconds. That
serverless deploy
function can update a lambda in about 2-3 seconds. Why can’t I use local debugging as much as I’d like? Well, my machine spins and runs super slow. I’ve got a 2016 Macbook pro with 16gb of RAM, but it’s chokes when I debug locally. It’s probably because I’ve got a lot of things open at the same time - including an iphone simulator which also has a debugger connected to my react-native app. But it will run so slowly that requests from my phone simulator timeout before they reach the local stack. I think part of the issue might be that locally, whenever a file is modified, SST calculates CDK changes. Perhaps it should detect a file modification and wait for me to hit enter to recalculate stack changes. I’m going to buy a new mac - but I’m waiting for the next version of the macbook pros to come out this fall.
I wonder if I’m the only person who has performance problems while debugging locally….anyone else have this issue?
r
We experienced the opposite, we were using serverless-offline with serverless framework previously to run stuff locally and that chewed up a lot of memory and CPU. On one of my team's linux machine it'd frequently needed a system restart. Running it via
sst start
shifts almost all the load to AWS so works very well for us.
t
@David Martin gotcha would you mind opening an issue with what you shared above? I want to leave some thoughts on it so want to make sure it's visible publicly
d
sure - do you want an issue for the deployment of a single function, or for the perf issues?
Re: perf - It might just be my machine
t
Deployment of a single function
f
@David Martin, about the perf,
whenever a file is modified, SST calculates CDK changes
SST doesn’t auto rebuild when you change ur Lambda code. When you are working on ur Lambda code, do you have the perf issue? Or the slow down only happens when you are changing the CDK code?
j
Yeah we gotta make sure it’s not flaky with 16GB!
d
@Frank I have to do some more investigating to find the source of the problem. But sometimes the debugger gets so laggy that I have to quit vscode because everything is so unresponsive. It's just been one of those days today.
I need a new machine. If others aren't having this problem then it might be isolated to me. But I don't want to buy a MacBook now only to have a new version come out with better specs. I've waited long enough already
@Frank, I see. It watches for changes to the CDK code: https://docs.serverless-stack.com/live-lambda-development#cdk-builds. One thing - it’d be nice if there was some way to force a redeployment manually while the debugger is running. As I’m modifying my schema.graphql, I need to manually start/stop the debugger to force a redeploy so my changes get pushed to my appsync stack. Not a huge deal and I can continue with that workflow. It might not be all that much faster anyway.
f
Ah yup that makes sense! Circling back on the perf issue, sst start normally is pretty efficient (I’m running on a dual core MBP). When u get a chance, can u check: • after starting up sst start, how much memory is node/esbuild taking while idle • does it slow down when changing SST code, if so what’s taking cpu/memory? • does it slow down when changing lambda code, if so what’s taking cpu/memory?
a
This could also be a disk issue or the max files open limit could be approaching. Happens a lot on macbooks when using android studio or react-native. I’d suggest keeping an eye on the activity monitor and then figuring out what limits you might be reaching / crossing.
d
@Frank ok, i’ll get those numbers for you. i’m also on a dual core MBP (3.5 GHz Dual-Core Intel Core i7). @Ashishkumar Pandey - oh, this could be the right path! i’ll take a look into the disk issue first. i’ll try running disk first aid or something.
a
sure. I really believe this is a disk or a config issue, all the best.
f
@David Martin yeah I’m on (2.3 GHz Dual-Core Intel Core i5), I hope that give you some hope 😁
d
good news! update: reset PRAM, ran disk first aid and “re-installed” OSX by upgraded OS from Catalina to Big Sur. happy to report that debugging is smooth and works 100% of the time now. thank you @Ashishkumar Pandeyfor the help! 🙏❤️
and thanks, @Frank too 😆
a
This is great. Happy coding. ✌️😁
t
Wow that's amazing