source-map support in production and locally
See original GitHub issueVersion: “serverless-webpack”: “3.0.0”
I am wondering if anyone has gotten source-map support working on production system. Because debugging based on AWS CloudWatch input has always been a good way to find problems in the production system. Identifying the problem with output like at products (C:/Users/piust/Documents/colugo/.webpack/service/handler.js:4173:61)
is really hard.
Has anyone gotten a solution for this? I’m running basic configuration from what I understand from webpack:
const path = require('path')
const Dotenv = require('dotenv-webpack')
const slsw = require('serverless-webpack')
module.exports = {
devtool: 'source-map',
entry: slsw.lib.entries,
target: 'node',
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader',
include: __dirname,
exclude: /node_modules/,
options: {
presets: ['es2015', 'stage-2'],
plugins: ['transform-runtime'],
},
}],
},
output: {
libraryTarget: 'commonjs',
path: path.resolve(__dirname, '.webpack'),
filename: 'handler.js', // this should match the first part of function handler in `serverless.yml`
},
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:15 (5 by maintainers)
Top Results From Across the Web
Enable source-map on production? - Medium
Step 1: Following code generates source map files for us. ... Step 2: Create URL morphing service which will take URL as an...
Read more >Should I Use Source Maps in Production? | CSS-Tricks
A "source map" is a special file that connects a minified/uglified version ... It might help you track down bugs in production more...
Read more >Using sourcemaps on production without exposing the source ...
Main takeaway is that you can specify the url to load sourcemaps from, and this allows you to debug minified application on production,...
Read more >How to use source maps in AWS Lambda with Node.js
A Lambda function without source map support. Let's start with a simple Lambda function without source maps. To add this function, open the...
Read more >Apply sourcemaps on local file system to minified production ...
Are you after troubleshooting a production issue (resolving a minified stack trace) or you just want to run prod code locally with source...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Make sure to add
require('source-map-support').install();
orimport "source-map-support/register";
to the top of your Lambda handlers to load the source map. Otherwise it will not be used. See here: https://github.com/evanw/node-source-map-supportI found a reasonable setup. Cloud logs work great. Local debugging is okayish.
Dependencies:
Wepack config:
.babelrc
Hope it helps.