Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Issue with working serverless-webpack

Abierto
#266 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
javascript, webpack
Área
cloud

Línea de trabajo

Comienza con la configuración del handler en serverless.yaml y webpack.config.js; después, compara las rutas .webpack generadas con el valor de _HANDLER mostrado en el error. Comprueba cómo el plugin y serverless-webpack derivan la ruta del handler empaquetado. Se considera terminado cuando la ruta del handler desplegado coincide con la ubicación generada .webpack/a-dir/a-handler.handle y la invocación de LocalStack se inicia correctamente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

serverless-webpack status: backlog status: response required

As the documentation says, I added this configuration inside my custom property in the serverless.yaml

  localstack:
    stages:
      # list of stages for which the plugin should be enabled
      - local
      - development
    host: http://localhost  # optional - LocalStack host to connect to
    edgePort: 4566  # optional - LocalStack edge port to connect to
    autostart: true  # optional - Start LocalStack in Docker on Serverless deploy
    networks: #optional - attaches the list of networks to the localstack docker container after startup
      - host
      - overlay
    lambda:
      # Enable this flag to improve performance
      mountCode: true  # specify either "true", or a relative path to the root Lambda mount path

The webpack config is this for the serverless:

 webpack:
    webpackConfig: ./webpack.config.js
    includeModules: true
    excludeFiles: tests/**/*.{js,ts}
    keepOutputDirectory: true

This is the webpack configuration:

const path = require('path');
const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');

module.exports = {
  entry: slsw.lib.entries,
  target: 'node',
  mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
  optimization: {
    minimize: false,
  },
  plugins: [],
  performance: {
    // Turn off size warnings for entry points
    hints: false,
  },
  externals: [nodeExternals()],
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: 'ts-loader?configFile=tsconfig.build.json',
        exclude: [/node_modules/, /tests/],
      },
    ],
  },
  resolve: {
    extensions: ['.ts', '.js'],
  },
  output: {
    libraryTarget: 'commonjs2',
    path: path.join(__dirname, '.webpack'),
    filename: '[name].js',
  },
  cache: {
    type: 'filesystem',
  },
};

And I'm getting this error:

Execution environment startup failed: {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'a-handler'\nRequire stack:\n- /var/runtime/index.mjs","trace":["Runtime.ImportModuleError: Error: Cannot find module 'a-handler'","Require stack:","- /var/runtime/index.mjs","    at _loadUserApp (file:///var/runtime/index.mjs:1087:17)","    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)","    at async start (file:///var/runtime/index.mjs:1282:23)","    at async file:///var/runtime/index.mjs:1288:1"]}

And it looks like is because the handler path is incorrect, it says this

'_HANDLER': '.webpack/service/src/a-dir/a-handler.handle'

But when webpack package the code is located in .webpack/a-dir/a-handler.handle, what would be the solution for that, I'm kind of lost, should I update the output path?

Lenguaje dominante
JavaScript
Estrellas
542
Forks
92
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de localstack/serverless-localstack

Todos los issues de localstack/serverless-localstack

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.