When running localstack and attempting to connect a remote js debugger, I am following the guide here: https://docs.localstack.cloud/user-guide/tools/lambda-tools/debugging/#debugging-nodejs-lambdas
I’ve created a custom profile (https://docs.localstack.cloud/references/configuration/#profiles) to simplify localstack start -d
my profile is:
LAMBDA_REMOTE_DOCKER=0
EDGE_BIND_HOST=0.0.0.0
LAMBDA_DOCKER_FLAGS=-e NODE_OPTIONS=--inspect-brk=0.0.0.0:9229 -p 9229:9229
DEBUG=1
PROVIDER_OVERRIDE_LAMBDA=asf
result of localstack config show
:
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Key ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ BUCKET_MARKER_LOCAL │ __local__ │
│ CUSTOM_SSL_CERT_PATH │ │
│ DATA_DIR │ │
│ DEBUG │ True │
│ DEFAULT_REGION │ us-east-1 │
│ DEVELOP │ False │
│ DEVELOP_PORT │ 5678 │
│ DISABLE_CORS_CHECKS │ False │
│ DISABLE_CORS_HEADERS │ False │
│ DISABLE_CUSTOM_CORS_APIGATEWAY │ False │
│ DISABLE_CUSTOM_CORS_S3 │ False │
│ DISABLE_EVENTS │ False │
│ DOCKER_BRIDGE_IP │ 172.17.0.1 │
│ DYNAMODB_ERROR_PROBABILITY │ 0.0 │
│ DYNAMODB_HEAP_SIZE │ 256m │
│ DYNAMODB_READ_ERROR_PROBABILITY │ 0.0 │
│ DYNAMODB_SHARE_DB │ 0 │
│ DYNAMODB_WRITE_ERROR_PROBABILITY │ 0.0 │
│ EAGER_SERVICE_LOADING │ False │
│ EDGE_BIND_HOST │ 0.0.0.0 │
│ EDGE_FORWARD_URL │ │
│ EDGE_PORT │ 4566 │
│ EDGE_PORT_HTTP │ 0 │
│ ENABLE_CONFIG_UPDATES │ False │
│ EXTRA_CORS_ALLOWED_HEADERS │ │
│ EXTRA_CORS_ALLOWED_ORIGINS │ │
│ EXTRA_CORS_EXPOSE_HEADERS │ │
│ HOSTNAME_EXTERNAL │ localstack │
│ HOSTNAME_FROM_LAMBDA │ │
│ KINESIS_ERROR_PROBABILITY │ 0.0 │
│ KINESIS_INITIALIZE_STREAMS │ │
│ KINESIS_MOCK_PERSIST_INTERVAL │ 5s │
│ LAMBDA_CODE_EXTRACT_TIME │ 25 │
│ LAMBDA_CONTAINER_REGISTRY │ lambci/lambda │
│ LAMBDA_DOCKER_DNS │ │
│ LAMBDA_DOCKER_FLAGS │ -e NODE_OPTIONS=--inspect-brk=0.0.0.0:9229 -p 9229:9229 │
│ LAMBDA_DOCKER_NETWORK │ │
│ LAMBDA_EXECUTOR │ │
│ LAMBDA_FALLBACK_URL │ │
│ LAMBDA_FORWARD_URL │ │
│ LAMBDA_JAVA_OPTS │ │
│ LAMBDA_REMOTE_DOCKER │ False │
│ LAMBDA_REMOVE_CONTAINERS │ True │
│ LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT │ 10 │
│ LAMBDA_RUNTIME_EXECUTOR │ │
│ LAMBDA_STAY_OPEN_MODE │ False │
│ LAMBDA_TRUNCATE_STDOUT │ 2000 │
│ LEGACY_DIRECTORIES │ False │
│ LEGACY_DOCKER_CLIENT │ False │
│ LEGACY_EDGE_PROXY │ False │
│ LOCALSTACK_HOSTNAME │ localhost │
│ LS_LOG │ False │
│ MAIN_CONTAINER_NAME │ localstack_main │
│ OPENSEARCH_ENDPOINT_STRATEGY │ domain │
│ OUTBOUND_HTTPS_PROXY │ │
│ OUTBOUND_HTTP_PROXY │ │
│ PERSISTENCE │ False │
│ S3_SKIP_SIGNATURE_VALIDATION │ True │
│ SKIP_INFRA_DOWNLOADS │ │
│ SKIP_SSL_CERT_DOWNLOAD │ False │
│ SQS_DELAY_PURGE_RETRY │ False │
│ SQS_DELAY_RECENTLY_DELETED │ False │
│ SQS_ENDPOINT_STRATEGY │ off │
│ SQS_PORT_EXTERNAL │ 0 │
│ STEPFUNCTIONS_LAMBDA_ENDPOINT │ │
│ SYNCHRONOUS_KINESIS_EVENTS │ True │
│ SYNCHRONOUS_SNS_EVENTS │ False │
│ TF_COMPAT_MODE │ False │
│ USE_SINGLE_REGION │ False │
│ USE_SSL │ False │
│ WAIT_FOR_DEBUGGER │ False │
│ WINDOWS_DOCKER_MOUNT_PREFIX │ /host_mnt │
└────────────────────────────────────┴─────────────────────────────────────────────────────────┘
However, when I start a lambda task, the container does not expose any ports. see docker ps
output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8577b6ae7369 public.ecr.aws/lambda/nodejs:18 "/var/rapid/init" 38 minutes ago Up 38 minutes 9ffd8d7ea1c59a638cc0276861d0e1e4
9b26cbe3cc23 localstack/localstack "docker-entrypoint.sh" 43 minutes ago Up 43 minutes (healthy) 0.0.0.0:4510-4559->4510-4559/tcp, 0.0.0.0:4566->4566/tcp, 0.0.0.0:4571->4571/tcp, 0.0.0.0:12121->12121/tcp, 5678/tcp localstack_main
per the localstack_main container logs, no ports appear to be passed to the lambda and the NODE_OPTIONS is not sent when created:
2022-12-15T22:22:27.661 DEBUG --- [cation_loop)] l.u.c.docker_sdk_client : Creating container with attributes: {'mount_volumes': None, 'ports': None, 'cap_add': None, 'cap_drop': None, 'security_opt': None, 'dns': None, 'additional_flags': None, 'workdir': None, 'privileged': None, 'command': None, 'detach': None, 'entrypoint': '/var/rapid/init', 'env_vars': {'LOCALSTACK_RUNTIME_ID': '9ffd8d7ea1c59a638cc0276861d0e1e4', 'LOCALSTACK_RUNTIME_ENDPOINT': 'http://172.17.0.2:4566/_localstack_lambda/9ffd8d7ea1c59a638cc0276861d0e1e4', 'AWS_LAMBDA_LOG_GROUP_NAME': '/aws/lambda/XXXXXX', 'AWS_LAMBDA_LOG_STREAM_NAME': '2022/12/15/[$LATEST]9ffd8d7ea1c59a638cc0276861d0e1e4', 'AWS_LAMBDA_FUNCTION_NAME': 'XXXXXX', 'AWS_LAMBDA_FUNCTION_TIMEOUT': 30, 'AWS_LAMBDA_FUNCTION_MEMORY_SIZE': 512, 'AWS_LAMBDA_FUNCTION_VERSION': '$LATEST', 'AWS_DEFAULT_REGION': 'us-east-1', 'TASK_ROOT': '/var/task', 'RUNTIME_ROOT': '/var/runtime', 'AWS_LAMBDA_INITIALIZATION_TYPE': 'on-demand', 'TZ': ':UTC', 'LOCALSTACK_HOSTNAME': '172.17.0.2', 'EDGE_PORT': '4566', 'AWS_ENDPOINT_URL': 'http://172.17.0.2:4566', '_HANDLER': './src/index.handler', 'AWS_EXECUTION_ENV': 'Aws_Lambda_nodejs18.x'}, 'image_name': 'public.ecr.aws/lambda/nodejs:18', 'interactive': None, 'name': '9ffd8d7ea1c59a638cc0276861d0e1e4', 'network': 'bridge', 'remove': None, 'self': <localstack.utils.container_utils.docker_sdk_client.SdkDockerClient object at 0x7f0b653b79a0>, 'tty': None, 'user': None}
Am I missing something or is this a bug? We want to use nodejs18.x and from everything I’ve read we have to use the ASF lambda provider.