Hey there, loving sst right now, especially the we...
# help
h
Hey there, loving sst right now, especially the web interface for the console. But when an invoked function throws an error, the web interface crashes and forces me to restart the console.
the error displayed in the web console is
Copy code
vendor.db536111.js:320 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
which seems to be from attempting to access the stacktrace
Copy code
children: [t.invocation.response.error.stackTrace.length === 0 ...
(i’m looking through the source to see if i can find the origin since the error points to the minified version)
m
Hey @Hans Song which tab in the console you mean? API tab?
h
it is the functions tab, i.e.
<https://console.serverless-stack.com/last-second/local/functions/>...
m
I'll check if i can reproduce it, meanwhile could you check the version of SST you're using and update to latest if not and try again?
h
here are the versions in my
package.json
Copy code
"@serverless-stack/cli": "0.67.0",
"@serverless-stack/resources": "0.67.0",
"aws-cdk-lib": "2.7.0"
i can push up my code and link it here if that will help
m
Could you share a screenshot of the console crash? It'll help to debug.
h
sure 🙂
it appears there is no
stackTrace
property in the invocations
m
working on it
h
thanks @manitej 🙏
m
I’m not seeing any crashes in console, errors are shown in the console.
f
@manitej does the crash only happen when there’s no stack trace?
m
I think yeah
f
in the screenshot u shared above, stack trace seems to be there
m
i guess it has no contents in it though, that’s why
map
throwing the error
f
what’ is
props.invocation.response.error.stackTrace
for u?
m
i think i found the error
f
i think
props.invocation.response.error.stackTrace
is
undefined
for @Hans Song?
h
yep, in the screenshot i sent earlier, the stackTrace property is missing
m
I think the error is related to the Go syntax
h
@manitej you mean related to how i structure error responses in my lambdas?
we need to handle this case in the console
h
the same issue happens when i avoid using something that would be mistaken for an escaped character
m
you are not getting the stacktrace it seems
h
yep…
f
@manitej can u see if this PR fixes this issue https://github.com/serverless-stack/serverless-stack/pull/1470
m
fixing it is easy, but i’m thinking why the
stacktrace
option is missing? backend related?
@Frank u can merge the PR
f
Merged. I think stack trace is optional, not all errors have it. But yeah let’s ping Dax and see if it’s a bug on the backend.
@thdxr is it expected that local invocation has
undefined
stack trace? ie.
Copy code
props.invocation.response.error.stackTrace
m
@Frank figured it out,
go
doesn’t have a stacktrace option in the response https://docs.aws.amazon.com/lambda/latest/dg/golang-exceptions.html#go-exceptions-createfunction
f
@Hans Song are you using
go
runtime?
h
yep
i linked my repo further up in this thread
side note - i would have expected the property to exist but have a value of undefined based on this? (if i’m understanding the source code correctly) https://github.com/serverless-stack/serverless-stack/blob/master/packages/core/src/runtime/server.ts#L187
f
I see. Do you know if you get stack trace if u deployed the code (with error) to AWS?
btw we just pushed a quick fix to the Console, can you refresh and see if it still crashes for u?
h
nice, its not crashing anymore 🙂 i’ll try doing a deploy now
f
Awesome!
h
just wanted to say, really loving the experience so far, especially how the bundling is cached, when i synth with the defaults in cdk, it redownloads all the dependencies for each lambda which can take a couple minutes 🙄
this might be my fault but am receiving this error from the deployed instance
Copy code
{
  "errorMessage": "fork/exec /var/task/handler: exec format error",
  "errorType": "PathError"
}
notably no
stackTrace
and the console is not crashing 🙂
m
Yeah, Go runtime doesn't have a stackTrace
f
@Hans Song were you able to figure out the
fork/exec
error above?
h
Hi frank, yeah it was to do with a missing environment variable because i’m deploying from an m1 machine, i need to set
GOARCH
to
amd64
f
Ah I see. Can you show me how you are setting it? Might be worth adding it to the doc.
h
it looked something like this within the main function
Copy code
app.setDefaultFunctionProps({
  runtime: "go1.x",
  environment: {
    CGO_ENABLED: "0",
    GOOS: "linux",
    GOARCH: "amd64",
  },
});
f
Got it. Thanks @Hans Song!