Runtime.HandlerNotFound Error when mountCode: true
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 38/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- aws, docker, javascript, nodejs
Direção de pesquisa
Comece revisando o pull request #215 e o caminho mountCode usado com serverless-esbuild; em seguida, reproduza o problema com os arquivos serverless.yaml e docker-compose.yaml fornecidos. Use a falha Runtime.HandlerNotFound registrada para rastrear por que o handler montado não está disponível. A tarefa estará concluída quando mountCode:true iniciar a Lambda com sucesso e as atualizações do código forem propagadas.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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)

- Linguagem predominante
- JavaScript
- Estrelas
- 542
- Forks
- 93
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de localstack/serverless-localstack
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 25/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 58/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 42/100
-
aws:apigateway status: backlog
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
localstack/serverless-localstack#270 · 3 reações ·
Todas as issues de localstack/serverless-localstack
Issues semelhantes
-
[quality] useFocusTrap's Shift+Tab wrap and non-Tab/non-Escape key arms are never driven end to endTalvez já em andamento @hivecommons-hive assumiu hoje. Abertaagent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31 quality testing
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
[aw] Upgrade availableAbertaagentic-workflows
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
githubnext/gh-aw-workshop#4220 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
JuliusBrussee/caveman#1189 ·
Mantenedores costumam responder em até 1 dia
-
priority:low ready-for-dev
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
OpenHands/extensions#738 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
invoiceninja/invoiceninja#13320 ·
Mantenedores costumam responder em até 1 dia