So tried to do some searching back through message...
# help
r
So tried to do some searching back through messages, this will likely be for @Frank as I dug this one up. https://serverless-stack.slack.com/archives/C01HQQVC8TH/p1625162181261800?thread_ts=1625149044.257100&cid=C01HQQVC8TH but I think it has been mentioned before I just cant find it. Right now when using typescript I need to save the lambda file itself,
route.ts
to get SST to rebuild the function in memory. However if
route.ts
depends on other files and they are updated an esbuild transpile is not triggered. I keep finding myself in situations where I am making changes and not seeing results, and realize I forgot I need to go back and save any route's that depend on that file to get it to re-build in dev mode. Am I totally missing something to get this to work better?
t
Hm this shouldn't be the case. We track dependencies and rebuild functions when any dependent file changes
let me double check
r
That’s definitely not right, I see TS recompiles happen when a file referenced by a handler is changed
r
Well that would be amazing, so what the heck am I doing wrong haha :)
t
Yeah I just checked and it works, the way this works under the hood is esbuild tells us all the files that depend on the function and we use that to create a mapping
let me think about how to debug
Copy code
npx esbuild --metafile=meta.json --bundle --format=cjs --sourcemap --platform=node --target=node14 --outfile=out.js src/node/function.ts
Run that replacing the src/node/function.ts with your function. Then check meta.json to see if
inputs
looks correct
r
Yup sure does. inputs has all the dependencies.
but yeah I hit an endpoint, i see the REQUEST and RESPONSE logged out. If i save the
route.ts
file I see
Building {file}
then
Done Building {file}
However if i change anything in a file that is imported by
route.ts
i do not see building
d
It wont rebuild for anything in
node_modules
, just in case that is what you are doing, but my experience matches @Ross Coundon’s otherwise.
r
Also totally down to hop into a screenshare or whatever if it can help. This is ofcourse super annoying haha. Though probably good its only me... I am using WSL2 /w ubuntu if that has impact. @Derek Kershner nope local files in my
src
folder...
d
I have had the “correct” experience in WSL2/U20.04, and can rule that out.
r
Not sure if this is at all related but when following the guide here to get VSCode debugging (https://docs.serverless-stack.com/live-lambda-development#debugging-with-visual-studio-code) When I try to run
Debug SST Start
It just says
Debugger Attached
for a few seconds then gives me the message
Add the sst.json config file in your project root to get started. Or use the create-serverless-stack CLI to create a new project.
So maybe its just having trouble finding files in general here.. 🤷‍♂️
Ah interesting. For the above issue, if I swap my default VSCode terminal profile from fish to bash it does work... I wonder if running
sst start
in bash instead of fish will change anything with building...
r
Works with zsh too, that's what I'm using
r
Wonder why fish causes issues... that's odd.. However Sadly bash doesn't fix my original typescript issue where changes to dependencies are not causing a rebuild
r
I've also found WebStorm to be way more reliable for debugging
f
Hey @Ross Gerbasi, just to clarify, if u run
sst start
directly from ur terminal in bash, you don’t get this error right?
Copy code
Add the sst.json config file in your project root to get started. Or use the create-serverless-stack CLI to create a new project.
But changing dependencies does not trigger a rebuild right?
r
@Frank yeah thats right.
sst start
forks fine in
fish
or
bash
. VSCode launcher for debugging only seems to work wish
bash
within vscode. Using
fish
shell with VSCode launcher results in locating
sst.json
error Neither
fish
or
bash
help with my TS dependency issue, I cannot get a dependent file to trigger a route rebuild. As mentioned earlier if you wanna hop on a call and check it out I can just show ya quick.
@Frank and @thdxr so more exploration into this. I just created a new SST project. with just a single api sample thing and tested it. It is updating properly when i change a dependency. So somehow I have gotten into a bad spot in my larger real project... Going to try to explore how i got into this state.