https://serverless-stack.com/ logo
#sst
Title
# sst
d

Dan Van Brunt

03/10/2022, 3:27 PM
[Possible Live Dev Bug? `0.60.2`*]:* Saving one function deploys a completely different one.
@thdxr any idea if this is/was an issue?
t

thdxr

03/10/2022, 4:49 PM
is that function used in your stacks?
the second one
d

Dan Van Brunt

03/10/2022, 4:49 PM
both are
t

thdxr

03/10/2022, 4:49 PM
So the reason this happens is there's some kind of dependency link between the two functions
d

Dan Van Brunt

03/10/2022, 4:49 PM
and keep in mind we’re no longer using “lambda code” (which both these are) in “cdk code”
t

thdxr

03/10/2022, 4:50 PM
when we detect a change we traverse the import tree for each function and see which funcs need to be rebuilt
d

Dan Van Brunt

03/10/2022, 4:50 PM
both function depend on the same file but I’m not editting that file
t

thdxr

03/10/2022, 4:51 PM
if you run
Copy code
esbuild --bundle  --platform=node ./lambda/graphql/graphql.ts --outfile=output.js --analyze=verbose
You'll get a print out of the dep tree
d

Dan Van Brunt

03/10/2022, 4:51 PM
also… no matter what traversing is being done… THE function I’m editting SHOULD deploy, no?
t

thdxr

03/10/2022, 4:51 PM
it should rebuild if it was already invoked once
d

Dan Van Brunt

03/10/2022, 4:51 PM
“if it was already invoked once”
?
t

thdxr

03/10/2022, 4:52 PM
When doing "sst start" it doesn't build any of your functions. Once a request comes in it'll build the function and then keep it monitored for rebuilds
d

Dan Van Brunt

03/10/2022, 4:52 PM
so I need to invoke that other function once in order for liveediting to work?
t

thdxr

03/10/2022, 4:52 PM
Yeah it lazy loads them so there's not a big slowdown on sst start for people who have a large number of functions
d

Dan Van Brunt

03/10/2022, 4:52 PM
ah! then that is likely it
then its still just odd that editing one function causing an unrelated one to deploy even though they only share one file that both dep on that I’m not editting
t

thdxr

03/10/2022, 4:55 PM
There might be something non-obvious going on, that analyze command should help you see if grpahql.ts is depending on the other function
d

Dan Van Brunt

03/10/2022, 4:56 PM
not sure how there could be a dep… they are both high lvl functions?
unless it simply because they are in adjacent folders?
f

Frank

03/16/2022, 11:54 PM
Just following up on this, @Dan Van Brunt r u still seeing this weird behavior?
Did this command offer any insight?
Copy code
esbuild --bundle  --platform=node ./lambda/graphql/graphql.ts --outfile=output.js --analyze=verbose