Just noticed, upon an error, that my Typescript so...
# help
a
Just noticed, upon an error, that my Typescript source maps aren't working. I know it did before migrating from Serverless Framework. Got
"sourceMap": true,
set and
import "source-map-support/register";
at the beginning of each Lambda handler. I see
.js.map
files being generated, but stack traces are showing .js files with large line numbers. Tips?
r
Do you have
--enable-source-maps
?
Copy code
app.setDefaultFunctionProps({
    environment: {
      NODE_OPTIONS: '--enable-source-maps',
    },
    runtime: 'nodejs14.x',
  })
a
Nope. I don't think I've ever set that environment variable option on a Lambda.
r
I set that in my index file, havent had any issues with sourcemaps
a
Huh. https://serverless.pub/aws-lambda-node-sourcemaps/ Shouldn't that be part of the SST magic?
Oh, I read more of the article. That flag is an experimental replacement for the source-map-support package that I am installing. Nicer than having to register in each Lambda handler, but should work.
Does that default environment get merged with the specific ones on each Lambda, or does specifying environment on individual lambdas replace all the variables?
r
I am not sure about merging. I believe it does. And I didnt realize what you were doing that. It's funny that's the same thing i did when I started. Using
"source-map-support/register";
@Frank gave me the
node_options
tip. Maybe this needs to be in the docs somewhere more obvious?
t
We didn't turn it on by default because it causes some severe performance issues
Wouldn't use it in prod and some people say it really slowed stuff for them locally