Hi <@U01JVDKASAC>: thank you and the sst team for ...
# sst
v
Hi @Frank: thank you and the sst team for providing much better experience working with serverless apps. Feature Request: Looks like "sst build / sst deploy " does not have a way to enable or disable source maps. It'd be really helpful if there is a flag that can be toggled to disable/enable source maps when deploying lambda functions
d
Source Maps | Serverless Stack (SST) (serverless-stack.com)
v
Hi @Derek Kershner: thank you for your response. the "NODE_OPTIONS" enables the use of source maps. I was hoping to find a way from SST generating the source map itself (during deploy) so that the deployed zip file will only contain the js file and not the js.map file for a given lambda function.
f
Thanks for the kind words @Viswa!
Lemme pull in @thdxr. He has looked into source map in depth a while back.
k
@Viswa Maybe I'm misunderstanding something, but I see
sst deploy
as the final stage of development that will upload your real code to run in the lamdba environment. Once in Lamdba, the code runs in it's own container on AWS where you don't have debug access any longer. What benefit would the source map on your machine bring at this stage? Or is this for a frontend deployment somehow? For backend cases while you are still developing / debugging the function, only a stub that forwards the request from lambda to your local machine is being uploaded. This live reload option then works directly with your local code (which isn't packaged up at that stage).
v
Hi @Klaus: My question is more about the package that gets deployed to AWS when you do
sst deploy
. I don't have any issues with the source map on my machine. I was wondering if there is a way to disable source maps from getting deployed to AWS as part of lambda function. By default, for a nodejs lambda the zip package includes lambda-function.js as well as lambda-function.js.map. And this source map almost doubles the size of lambda function and that increases the cold start time. So, my question is when I do
ss deploy
only lambda-function.js should be packaged into the zip file that gets deployed to the AWS. Hope this helps!
t
we definitely need to support disablign sourcemaps, thought we already did
The reason to keep sourcemaps in prod is because bundling throws off stack traces without it. That said I agree it increases the bundle size and coldstarts are important. Ideal flow is sourcemaps are uploaded to your error monitoring service (like sentry) during deploy but not bundled
v
@thdxr: yeah, sourcemaps are needed for debugging stack traces and errors. I could not find any references from sst documentation regarding disabling sourcemaps (from being in the bundle and not NODE_OPTIONS). Can you please point me to any documentation that helps me run sst deploy without bundling sourcemaps?
t
I don't think we expose that option yet, we can add it
k
@Viswa if you are using sentry, perhaps this covers your needs
v
@Klaus :No, we are not using sentry, as far as I know! 🙂
d
Yes, in our application we bundle sourcemaps to production, but we don’t get helpful stack traces, we only get ones that link to JS
We’d assumed that we were not bundling them in prod, so we were not setting the NODE_OPTIONS to match