Seeing error running 0.54.2
# sst
j
Seeing error running 0.54.2
t
what version of node are you on?
j
v12.14.1
t
ah can you possibly go to v14? If not I can rework that
j
what 14.x version are you running?
t
I'm actually on 16
Some parts of our codebase aren't transpiled so it looks like I used some features not available in 12
j
Like to keep dev on same as AWS Lambda so will stick with 14
t
Yeah FYI Node 12 isn't under active support anymore and is being EOL'd in April 2022
OK
going to v14.18.2 seems to have fixed it
p
I had this error and the upgraded node version got rid of it. I can now run using "npm start". However, whenever I try to kick off live debug I hit this error:
Copy code
[2021-12-14T15:54:15.180] [DEBUG] default - Error: There was an error synthesizing your app.
    at ChildProcess.<anonymous> (C:\Users\pa-de\Work\dentr\backend\node_modules\@serverless-stack\core\dist\index.js:132:31)
    at ChildProcess.emit (events.js:400:28)
    at ChildProcess.emit (domain.js:475:12)
    at ChildProcess.cp.emit (C:\Users\pa-de\Work\dentr\backend\node_modules\cross-spawn\lib\enoent.js:34:29)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
    at Process.callbackTrampoline (internal/async_hooks.js:130:17) {
  stderr: 'Debugger attached.\r\n' +
    'Debugger attached.\r\n' +
    '\n' +
    'Error: There was a problem transpiling the Lambda handler.\n' +
    '    at Object.bundle (C:\\Users\\pa-de\\Work\\dentr\\backend\\node_modules\\@serverless-stack\\core\\dist\\runtime\\handler\\node.js:149:23)\n' +
    '    at Object.bundle (C:\\Users\\pa-de\\Work\\dentr\\backend\\node_modules\\@serverless-stack\\core\\dist\\runtime\\handler\\handler.js:30:16)\n' +
    '    at new Function (C:\\Users\\pa-de\\Work\\dentr\\backend\\node_modules\\@serverless-stack\\resources\\src\\Function.ts:338:39)\n' +
    '    at _ApisStack.createJWTAuthorizer (C:\\Users\\pa-de\\Work\\dentr\\backend\\lib\\_stackUtils.service.ts:239:16)\n' +
    '    at new _ApisStack (C:\\Users\\pa-de\\Work\\dentr\\backend\\lib\\ApisStack.ts:18:36)\n' +
    '    at Object.main (C:\\Users\\pa-de\\Work\\dentr\\backend\\lib\\index.ts:40:21)\n' +
    '    at Object.<anonymous> (C:\\Users\\pa-de\\Work\\dentr\\backend\\.build\\run.js:94:16)\n' +
    '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
    '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
    '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
    '\n' +
    'Waiting for the debugger to disconnect...\r\n' +
    'Waiting for the debugger to disconnect...\r\n'
}
[2021-12-14T15:54:15.183] [ERROR] default - There was an error synthesizing your app.
t
Does this happen even with debugger attached?
p
This happens when I click the play button in VSCode.
I think I might have found the issue though - just going to try it
t
Sorry I meant does it happen if you don't have the debugger attached? Running
sst start
from console
p
npm run start works, which does an sst start
t
Odd because this error should only show up when building for production
p
Yup, I found it
Someone else had added
enableLiveDev=false
to the lambda authorizer we add. Seems to be enough to stop live debug for everything.
j
(only on windows) works fine on mac
p
Wouldn't be the first Windows only bug - there was another a few months back that I think @thdxr fixed
t
wait which issue is windows only?
p
The error I posted above
t
Oh do you two work together haha
Forgot that
p
Easily done - there's a lot of us now!
t
OK I think I need to print the actual build error to see what's going on
p
I've only seen the issue on my machine - I didn't think Jack had tried live debug on his mac yet but I guess he must have.
t
The error you posted is from non-live-debug, when doing a normal build
p
No. The error I posted is when I try to kick off a live debug session.
When I do a normal sst start, it's fine
t
Hm from what I can see that error you're seeing is only ever thrown inside the function that builds it normally (non live debug)
By non-live-debug I mean sst start, not talking about vscode debugger
p
I'm using the SST Start configuration in VSCode:
Copy code
{
      "name": "SST (Start Debug)",
      "type": "node",
      "request": "launch",
      "cwd": "${workspaceRoot}/backend",
      "runtimeExecutable": "${workspaceRoot}/backend/node_modules/.bin/sst",
      "runtimeArgs": ["start", "--increase-timeout"],
      "console": "integratedTerminal",
      "skipFiles": ["<node_internals>/**"]
    },
t
Here let's try something
p
When I go to a terminal and run
npm run start
there's no error:
Copy code
"scripts": {
    "test": "sst test",
    "start": "sst start",
    "build": "sst build",
    "deploy": "sst deploy",
    "remove": "sst remove"
  },
t
can you edit this file: ./node_modules/@serverless-stack/core/dist/runtime/handler/node.js On line
147
or so there should be an
err
variable - can you put a log statement under it and run it again?
p
Done that and the error appears to be empty:
Copy code
===============
 Deploying app
===============

Debugger attached.
Debugger attached.
{ skipPostDeploy: true, app_local: true }
Debugger attached.
Waiting for the debugger to disconnect...
 TRANSPILE ERROR
I'm not seeing any .sst/artifacts folders either... (just read the 0.54.0 release notes again)
I'm on 0.54.2
t
Ah I see it looks like
err
is returning a blank string which is passing the if statement
trimming should do the trick, let me push a fix
hm actually before I do that, can you also log
result.stdout.toString()
p
Just trying to run it normally first - I have someone waiting for the code changes I'm trying to run! Unfortunately 0.54.2 seems broken for me - even npm run start (i.e. sst start) in a console window isn't working either. Just chews up loads of memory and then eventually crashes:
Get's to here:
Copy code
==========================
 Starting Live Lambda Dev
==========================
Up to 8GB now and still going this time - seems to crash a bit sooner in VSCode
t
hm in this build sst start doesn't actually do anything when starting up so that's strange
p
It started creating things inside the .sst/artifact folder this time - so it was trying to do something.
t
Are there requests coming in?
p
It was still trying to start the live lambda dev bit - hadn't got to the point of processing any requests
t
The way this build works is on
sst start
nothing should be built until a request comes in. If things are being built it might be functions marked with
enableLiveDev: false
But that should happen one by one so that shouldn't stress your system
p
I tried it with the authorizer's enableLiveDev set to true and false - didn't seem to make much difference
t
and that should be done by the time it hits "Starting live dev" anyway hm
p
I've rolled back to 0.53.4 now to get my PR submitted.
t
yeah let me look into this now and see if I can figure it out
p
Cool - thanks
t
You never see this in the log right
<http://clientLogger.info|clientLogger.info>("Debug session started. Listening for requests...")
p
It never got that far
t
let me know when one of you can run some debug steps
p
It might be January now tbh but I'll let you know if we can do sooner.