Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: Cannot Tail Logs When Using awslocal V1 #12123

Open
@SpongeManiac

Description

@SpongeManiac

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When attempting to view a live tail of logs using awslocal with API v1, I receive the following error:

$ awslocal logs start-live-tail --log-group-identifiers /aws/lambda/test-lambda

Could not connect to the endpoint URL: "http://streaming-localhost:4566/"

Expected Behavior

I expect to see a live tail to start for this resource.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

I start LocalStack with Docker Compose:
services:
  localstack:
    container_name: localstack-main
    image: localstack/localstack
    ports:
      - "127.0.0.1:4566:4566"                     # LocalStack Gateway
      - "127.0.0.1:4510-4559:4510-4559"  # external services port range
    environment:
      # LocalStack configuration: https://docs.localstack.cloud/references/configuration/
      - DEBUG=${DEBUG:-0}
    volumes:
      - /home/portainer/volumes/localstack:/var/lib/localstack
      - /var/run/docker.sock:/var/run/docker.sock

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

function.zip/index.js

exports.handler = async (event) => {
    let body = JSON.parse(event.body)
    const product = body.num1 * body.num2;
    const response = {
        statusCode: 200,
        body: "The product of " + body.num1 + " and " + body.num2 + " is " + product,
    };
    return response;
};

config.json

{
        "LambdaFunctionConfigurations": [
                {
                        "Id": "s3eventtriggerslambda",
                        "LambdaFunctionArn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda",
                        "Events": ["s3:ObjectCreated:*"]
                }
        ]
}

Commands

$ awslocal lambda create-function --function-name test-lambda --runtime nodejs18.x --zip-file fileb://function.zip --handler index.handler --role arn:aws:iam::000000000000:role/lambda-role'

$ awslocal lambda invoke --function-name test-lambda --payload '{"body": "{\"num1\": \"10\", \"num2\": \"10\"}" }' output.txt
$ cat output.txt

{"statusCode":200,"body":"The product of 10 and 10 is 100"}

$ awslocal s3 mb s3://test-bucket
 
$ awslocal s3api put-bucket-notification-configuration --bucket test-bucket --notification-configuration file://config.json

$ awslocal logs start-live-tail --log-group-identifiers /aws/lambda/test-lambda

Could not connect to the endpoint URL: "http://streaming-localhost:4566/"

Environment

- OS: Ubuntu 24.04 LTS x86_64
- LocalStack:
  LocalStack version: 4.0.4.dev98
  LocalStack Docker image sha: sha256:7a2db1e3f296f4647e61ffa5eebf97029aa056039be8642b36df003daa27c536
  LocalStack build date: 2025-01-09
  LocalStack build git hash: 630b2a111

Anything else?

Logs

2025-01-10T15:53:00.874  INFO --- [et.reactor-0] localstack.request.aws     : AWS lambda.CreateFunction => 201

2025-01-10T15:53:13.568  WARN --- [et.reactor-1] l.services.lambda_.hints   : Lambda functions are created and updated asynchronously in the new lambda provider like in AWS. Before invoking test-lambda, please wait until the function transitioned from the state Pending to Active using: "awslocal lambda wait function-active-v2 --function-name test-lambda" Check out https://docs.localstack.cloud/user-guide/aws/lambda/#function-in-pending-state

2025-01-10T15:53:13.569  INFO --- [et.reactor-1] localstack.request.aws     : AWS lambda.Invoke => 409 (ResourceConflictException)

2025-01-10T15:53:33.673  INFO --- [et.reactor-0] l.u.container_networking   : Determined main container network: openstack_default

2025-01-10T15:53:33.682  INFO --- [et.reactor-0] l.u.container_networking   : Determined main container target IP: 172.20.0.2

2025-01-10T15:53:36.034  INFO --- [et.reactor-1] localstack.request.http    : POST /_localstack_lambda/7df36d1e9dd80926b861c596c63948d3/status/7df36d1e9dd80926b861c596c63948d3/ready => 202

2025-01-10T15:53:36.049  INFO --- [et.reactor-1] localstack.request.http    : POST /_localstack_lambda/7df36d1e9dd80926b861c596c63948d3/invocations/71a7bab7-a1ba-47f6-bb66-41b765a93f29/logs => 202

2025-01-10T15:53:36.052  INFO --- [et.reactor-1] localstack.request.http    : POST /_localstack_lambda/7df36d1e9dd80926b861c596c63948d3/invocations/71a7bab7-a1ba-47f6-bb66-41b765a93f29/response => 202

2025-01-10T15:53:36.061  INFO --- [et.reactor-0] localstack.request.aws     : AWS lambda.Invoke => 200

2025-01-10T15:55:37.372  INFO --- [et.reactor-1] localstack.request.aws     : AWS s3.CreateBucket => 200

2025-01-10T15:58:03.884  INFO --- [et.reactor-1] localstack.request.aws     : AWS s3.PutBucketNotificationConfiguration => 200

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions