Heya. Regarding Live Lambda Debugging... It seems...
# help
t
Heya. Regarding Live Lambda Debugging... It seems like the debug web socket is still coming to my local environment, but my lambda updates aren't being applied. It's as if the "artifact" that was initially built on "sst start" is being used. I have to stop and restart "sst start" to get the changes to kick in. Any thoughts on idea on how to troubleshoot or debug this? Works correctly in another project using a slightly older version of SST.
t
When you make a change and save, does anything print to the console about the function being rebuilt?
t
I get...
Copy code
Stacks: Building changes...
Stacks: Synthesizing changes...
Stacks: No changes to deploy.
Which makes sense, I think, because nothing is changing from a remote/CloudFormation perspective. But... if I were to, say, add a console.log to the Lambda, it doesn't pick up the change unless I stop and restart SST. I'm hoping isn't something silly (like sst-env "not working" because I didn't have type="module" on my <script> tags in my HTML files).
r
What version of SST are you on?
t
60.6
t
When you change function code do you see it print anything?
t
I get the "Stacks: ..." output, shown above, and then when I invoke the function via a call to the API endpoint, I can see the "built in" console logs that appear in light grey (sample below), but not the hard console log that I put in which appears in white.
Copy code
90c605f6-9c15-4405-9f9c-ef9b1922d947 REQUEST xxx-stack-apiLambdaGETrequestpk1CF9-vjUcL7ASYS54 [stack/api-gateway/request-read.handler] invoked by API GET /request/01cffe7c-baf6-45ec-bb9f-73b3630e0678
90c605f6-9c15-4405-9f9c-ef9b1922d947 RESPONSE {"headers":{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":true},"statusCode":200,"body":"{}"}
I'm firing up my other project that uses SST version 51.1... going to test there, too.
t
I meant when you make a change to the file with the lambda and hit save, you don't see anything printing?
do you have a non-standard folder structure? Eg are your functions inside your stacks folder?
t
(My project that uses version 51.1 works as expected.)
When I change the file with the lambda and hit save, I see this...
Copy code
Stacks: Building changes...
Stacks: Synthesizing changes...
Stacks: No changes to deploy.
Both of my project (v51.1 and v60.1) use the same folder structure. I have the project/folder root (where .sst exists), and then...
Copy code
/stack/
  /index.js (the SST Stack code)
  /api-gateway/*.js (the lambdas)
  /website/** (the website files)
I modified the entry point at (sst.json).main to reflect the correct folder name ("stack").
Same setup works in both projects. Just this "Live Lambda" isn't working for me. Like I said, it seems like the socket is coming to my local environment to execute, but the incremental changes to the lambdas after the initial sst start are not being applied.
Seems like the file watcher triggers a stack check, but doesn't adjust the code that the down-socket is executing.
t
This issue is because our file watcher for function code ignores the sst main directory
As tempting it is to colocate things like this we generally recommend keeping application code and stacks code separate. However I think we can remove that ignore, I can't think of why we need it
ah for people who have srcPath set to root, we didn't want stacks code changes triggering lambda rebuilds. We filter through esbuild meta files anyway now so it's probably fine - I'll remove
t
interesting.
@thdxr Will you let me know when I can update SST in my project? I'm assuming this would come out as a minor update, ya?
j
@thdxr or @Frank let’s turn this into a GH issue?
t
@Tim V just released this
t
Thank you! (Sorry, had a baby on 2/4 and haven't been back until now.) @thdxr @Frank
f
@thdxr might be too young, but I know what that’s like 😜 Congrats man!
r
Congratulations @Tim V 👶🏻 🥱
j
Yay congrats @Tim V!