Runtime.HandlerNotFound Error when mountCode: true
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- aws, docker, javascript, nodejs
Línea de trabajo
Comienza revisando el pull request #215 y la ruta mountCode utilizada con serverless-esbuild; después, reproduce el problema con los archivos serverless.yaml y docker-compose.yaml proporcionados. Usa el fallo Runtime.HandlerNotFound registrado para rastrear por qué el handler montado no está disponible. Se considera terminado cuando mountCode:true inicia correctamente la Lambda y las actualizaciones del código se propagan.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I'm using localstack with a docker setup (localstrack-pro:latest), and when having mountCode:true in my plugin config the lambda container that is being spun up is unable to find the code. When disabled it executes fine but then code updates are not being propagated.
I added the fix of this pull request: #215 locally.
I'm also using serverless-esbuild.
serverless.yaml
service: cms-api
configValidationMode: error
provider:
stackName: ${env:STACK_NAME, 'serverless-framework'}-sls-middleware
name: aws
runtime: nodejs18.x
stage: local
region: ${env:AWS_DEFAULT_REGION, 'eu-central-1'}
environment: ${file(./serverless.yml):provider.environment}
apiGateway:
binaryMediaTypes:
- '*/*'
restApiId: !Ref ApiGateway
restApiRootResourceId:
'Fn::GetAtt':
- ApiGateway
- RootResourceId
plugins:
- serverless-esbuild
- serverless-localstack
custom:
stage: local
esbuild:
bundle: true
minify: false
keepOutputDirectory: true
outputFileExtension: .mjs
format: esm
target: "esnext"
platform: "node"
exclude: ["aws-sdk"]
banner:
js: import { createRequire } from 'module';const require = createRequire(import.meta.url);
localstack:
debug: true
edgePort: 4566
autostart: false
stages: [ local ]
lambda:
mountCode: true
functions:
api: ${file(./serverless.yml):functions.api}
resources:
Resources:
DynamoDBTableCMS: ${file(./serverless.yml):resources.Resources.DynamoDBTableCMS}
ApiGateway:
Type: AWS::ApiGateway::RestApi
Properties:
Name: ApiGateway
Tags:
- Key: _custom_id_
Value: cms-api
docker-compose.yaml
version: "3"
services:
localstack:
container_name: "api-localstack"
build:
context: ./docker/localstack
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
- "127.0.0.1:53:53" # DNS config (only required for Pro)
- "127.0.0.1:53:53/udp" # DNS config (only required for Pro)
- "127.0.0.1:443:443" # LocalStack HTTPS Gateway (only required for Pro)
working_dir: /
environment:
- SERVICES=lambda,s3,sqs,iam,apigateway,dynamodb # SERVICES variable is ignored if EAGER_SERVICE_LOADING=0
- LS_LOG=debug
- PERSISTENCE=1
- BUCKET_MARKER_LOCAL=hot-reload
- LOCALSTACK_API_KEY={redacted} # only required for Pro
- DOCKER_HOST=unix:///var/run/docker.sock
- STACK_NAME=api
- ENVIRONMENT=local
- DYNAMODB_SHARE_DB=1
volumes:
- "./docker/localstack/volume:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./:/app"
When the errors happens it keeps re spawning the lambda container until I stop it.
Logs
api-localstack | 2023-03-31T08:56:57.475 DEBUG --- [pi:$LATEST_0] l.u.c.docker_sdk_client : Creating container with attributes: {'mount_volumes': <localstack.utils.container_utils.container_client.VolumeMappings object at 0x7ff925c23880>, 'ports': None, 'cap_add': None, 'cap_drop': None, 'security_opt': None, 'dns': '127.0.0.1', 'additional_flags': '', 'workdir': None, 'privileged': None, 'labels': None, 'ulimits': None, 'command': None, 'detach': None, 'entrypoint': '/var/rapid/init', 'env_vars': {'AWS_DEFAULT_REGION': 'us-east-1', 'AWS_REGION': 'us-east-1', 'AWS_LAMBDA_FUNCTION_NAME': 'api-local-api', 'AWS_LAMBDA_FUNCTION_MEMORY_SIZE': 1024, 'AWS_LAMBDA_FUNCTION_VERSION': '$LATEST', 'AWS_LAMBDA_INITIALIZATION_TYPE': 'on-demand', 'AWS_LAMBDA_LOG_GROUP_NAME': '/aws/lambda/api-local-api', 'AWS_LAMBDA_LOG_STREAM_NAME': '2023/03/31/[$LATEST]0af9cbe7a820c0ba0db5030e64e1a184', 'AWS_ACCESS_KEY_ID': 'ASIAQAAAAAAADD2Y7UJJ', 'AWS_SECRET_ACCESS_KEY': 'yKdyaQMgFPFCyBv4nPtbiWaYIjrsvq3cV1gPFSl8', 'AWS_SESSION_TOKEN': 'FQoGZXIvYXdzEBYaD/DkcwdRjXJnysJVWiDvT8it86Tfw38AdeGKjio0Af69yx/ZcohR60kbG1Gu07EkxZO/j/s864mi/lgO5ktQrb4XVSn5GlB7gAU4Q2JOmlVCTaTXcnAvbix42UMVfkOfKHp6Prvl9yxB2aPqoy8Z2hXrr3vRAHcWwE9rFYVXn7lTDSCBfb8rLyB19Qfrhnqn35yK4URyJVgVsjHzqp0EtZvxOgSirgSo7U9OJRH/c4luhx3BxOcfyqBKKf3zxRILTx1z8VAT4QTfs7zhMJwpo+1AqWeYByodRP7XUtlRCLwts6nqdlomBDq7DzYdjJSRjSbpgRREFJGMxkDD3xE=', 'LAMBDA_TASK_ROOT': '/var/task', 'LAMBDA_RUNTIME_DIR': '/var/runtime', 'AWS_XRAY_CONTEXT_MISSING': 'LOG_ERROR', 'AWS_XRAY_DAEMON_ADDRESS': '127.0.0.1:2000', '_AWS_XRAY_DAEMON_PORT': '2000', '_AWS_XRAY_DAEMON_ADDRESS': '127.0.0.1', 'TZ': ':UTC', 'AWS_LAMBDA_FUNCTION_TIMEOUT': 6, 'LOCALSTACK_HOSTNAME': '172.30.0.2', 'EDGE_PORT': '443', 'AWS_ENDPOINT_URL': 'http://172.30.0.2:443', 'LOCALSTACK_RUNTIME_ID': '0af9cbe7a820c0ba0db5030e64e1a184', 'LOCALSTACK_RUNTIME_ENDPOINT': 'http://172.30.0.2:443/_localstack_lambda/0af9cbe7a820c0ba0db5030e64e1a184', '_HANDLER': '.esbuild/.build/src/handler/http.handle', 'AWS_EXECUTION_ENV': 'Aws_Lambda_nodejs18.x', 'ENVIRONMENT': 'local', 'LOCALSTACK_HOT_RELOADING_PATHS': '/var/task', 'LOCALSTACK_ENABLE_DNS_SERVER': '1', 'NODE_TLS_REJECT_UNAUTHORIZED': '0'}, 'image_name': 'public.ecr.aws/lambda/nodejs:18', 'interactive': None, 'name': 'api-localstack-lambda-api-local-api-0af9cbe7a820c0ba0db5030e64e1a184', 'network': 'cms_api_default', 'platform': 'linux/amd64', 'remove': None, 'self': <localstack.utils.container_utils.docker_sdk_client.SdkDockerClient object at 0x7ff96b9b6b30>, 'tty': None, 'user': None}
api-localstack | 2023-03-31T08:56:57.518 DEBUG --- [pi:$LATEST_0] localstack.packages.api : Installation of awslambda-runtime skipped (already installed).
api-localstack | 2023-03-31T08:56:57.518 DEBUG --- [pi:$LATEST_0] l.u.c.docker_sdk_client : Copying file /var/lib/localstack/lib/awslambda-runtime/v0.1.16-pre/x86_64/. into api-localstack-lambda-api-local-api-0af9cbe7a820c0ba0db5030e64e1a184:/
api-localstack | 2023-03-31T08:56:57.824 DEBUG --- [pi:$LATEST_0] l.u.c.docker_sdk_client : Starting container api-localstack-lambda-api-local-api-0af9cbe7a820c0ba0db5030e64e1a184
api-localstack | 2023-03-31T08:56:57.827 DEBUG --- [ asgi_gw_0] l.u.c.docker_sdk_client : Removing container: api-localstack-lambda-api-local-api-9de9563801ea86a2fc7cb199626b3200
api-localstack | 2023-03-31T08:56:57.946 INFO --- [ asgi_gw_0] localstack.request.http : POST /_localstack_lambda/9de9563801ea86a2fc7cb199626b3200/status/9de9563801ea86a2fc7cb199626b3200/error => 202
api-localstack | 2023-03-31T08:56:58.250 DEBUG --- [pi:$LATEST_0] l.u.c.container_client : Getting ipv4 address for container api-localstack-lambda-api-local-api-0af9cbe7a820c0ba0db5030e64e1a184 in network cms_api_default.
api-localstack | 2023-03-31T08:56:58.421 WARN --- [ asgi_gw_0] l.s.a.i.executor_endpoint : Execution environment startup failed: {"errorType":"Runtime.HandlerNotFound","errorMessage":".esbuild/.build/src/handler/http.handle is undefined or not exported","trace":["Runtime.HandlerNotFound: .esbuild/.build/src/handler/http.handle is undefined or not exported"," at UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1035:15)"," at async start (file:///var/runtime/index.mjs:1195:23)"," at async file:///var/runtime/index.mjs:1201:1"]}
api-localstack | 2023-03-31T08:56:58.421 DEBUG --- [ asgi_gw_0] l.u.c.docker_sdk_client : Stopping container: api-localstack-lambda-api-local-api-0af9cbe7a820c0ba0db5030e64e1a184
Screenshot of the built code:

Screenshot of the lambda on app.localstack.cloud (this is with mountCode: false)

Screenshot of the lambda on app.localstack.cloud ( this is with mountCode: true)

- Lenguaje dominante
- JavaScript
- Estrellas
- 542
- Forks
- 92
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de localstack/serverless-localstack
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 25/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
-
Support for Python 3.13 Lambdas Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Serverless deploy to LocalStack fails: “Invalid character in header content [authorization]” Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
-
Static API Gateway V1 Endpoints Abiertoaws:apigateway status: backlog
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
localstack/serverless-localstack#270 · 3 reacciones ·
Todos los issues de localstack/serverless-localstack
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Theme loads third-party resources on every page (jsdelivr web font, cdnjs Font Awesome) – GDPR Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
nightscout/nocturne#1414 ·
-
bug v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
modelcontextprotocol/inspector#2458 · 1 comentario ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
carbon-design-system/ibm-products#9907 ·