Runtime.HandlerNotFound Error when mountCode: true
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- aws, docker, javascript, nodejs
Direzione di ricerca
Inizia esaminando la pull request #215 e il percorso mountCode utilizzato con serverless-esbuild, quindi riproduci il problema con i file serverless.yaml e docker-compose.yaml forniti. Usa l’errore Runtime.HandlerNotFound registrato per tracciare il motivo per cui l’handler montato non è disponibile. Il lavoro è completato quando mountCode:true avvia correttamente la Lambda e gli aggiornamenti del codice vengono propagati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)

- Lingua principale
- JavaScript
- Stelle
- 542
- Fork
- 92
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di localstack/serverless-localstack
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 25/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
-
aws:apigateway status: backlog
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
localstack/serverless-localstack#270 · 3 reazioni ·
Tutte le issue di localstack/serverless-localstack
Issue simili
-
bug customer-eng Durable Agents Inngest status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
optimization optimization:agents-md-curator
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
AOSSIE-Org/OrgExplorer#253 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100