I'm seeing a problem with connecting a live debug ...
# sst
r
I'm seeing a problem with connecting a live debug or
sst start
session with the app I'm migrating to SST. When calling a function via API Gateway or via a Cognito hook, it returns a 500 Internal Server Error and I see this in logs (apologies for screenshot, it's spread over many lines so difficult to copy/paste). The lambdas aren't in a VPC. Any thoughts on what could be going on?
I've checked the path that's set in the NODE_OPTIONS env var
Copy code
/Applications/Visual Studio <http://Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js|Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js>
and that does exist on my machine.
I've since taken the SST TypeScript starter and deployed that into the same account and debugging works fine. (Raised a PR in the serverless-stack repo to correct the include path in tsconfig) So quite why/how this other app is different, I'm really not sure
Clutching at straws, tried deploying to a different region that I know to have worked in the past but same error 😞
f
Hey @Ross Coundon, what is
NODE_OPTIONS
set to?
r
Hi - it's
Copy code
--require "/Applications/Visual Studio <http://Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js|Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js>" --inspect-publish-uid=http
f
I think the problem is that the AWS Lambda runtime is looking for the file and not able to find it. It’s happening before the request was sent to ur local machine.
This shouldn’t work b/c the stub Lambda that’s deployed via
sst start
won’t have the
bootloader.bundle.js
.. did this work for you before?
r
It works in all my other projects!
f
🤯this is strange… this MacOS path for sure won’t exist inside lambda lol..
/Applications/Visual Studio <http://Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js|Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js>
@thdxr looked into
NODE_OPTIONS
recently, lemme see if he can spot anything
r
yeah, very odd!
t
Isnt the issue that error is happening in the cloud
If node options are set to that, AWS will try to require that module before it forwards down the request
Trying to think if there's a way to set that only on the local environment, forgetting if we load .env files into the function enc
f
If I recall correctly,
.env
files are only loaded in SST code, both for
start
and
deploy
Ross said it works in his other projects… which is very strange… should always fail right?
@Ross Coundon are you setting the
NODE_OPTIONS
manually? What does it do in this case?
t
Where is node options being set
r
I wonder if this is related to the setting of NODE_OPTIONS for epsagon, which I've now disabled
and it's getting copied automatically from what VSC sets locally
gotta be it
That was it 😞
This hadn't occurred to me because I had decided that the the locally running node process needed that value to connect to the debugger. Stepping back architecturally that doesn't make a lot of sense but it's been a long week
t
ok back from lunch let me take a closer look
oh you figured it out 😄