Hi,
I’m trying to invoke my function locally, but he keeps saying that ‘Lambda is not a function’. I don’t understand why because the generated file definitely exports a function.
My setup:
webpack.config.js
const path = require('path');
const slsw = require("serverless-webpack");
module.exports = {
target: 'node',
entry: slsw.lib.entries,
output: {
library: "default",
filename: '[name].js',
path: path.join(__dirname, '.webpack'),
libraryTarget: "commonjs"
},
mode: "production",
module: {
rules: [
{
test: /\.js|\.jsx$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.module\.scss$/,
use: [
{
loader: 'css-loader',
options: {
sourceMap: true,
url: true,
modules: {
exportLocalsConvention: 'camelCase',
localIdentName: '[path][name]__[local]--[hash:base64:5]',
},
},
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
includePaths: [path.resolve(__dirname, '../node_modules')],
},
},
},
],
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
}
};
serverless.yml
service: component1
plugins:
- serverless-webpack
- serverless-express
custom:
webpack:
packager: yarn
provider:
name: aws
runtime: nodejs12.x
region: eu-west-1
functions:
test:
handler: handler.default
events:
- http:
method: post
path: /
environment:
SERVERLESS_EXPRESS_PLATFORM: aws
Output
exports.default=function(e){var t={};function n(r){....
var ...
var ...