Skip to content

(CLI): watch logs always end with the 'truncated' message #18805

@skinny85

Description

@skinny85

What is the problem?

When using cdk watch, the logs always end with:

[/aws/lambda/HackathonExampleStack-NodeJsFunction6DD2A8DD-adO4KmEjQSuq] 5:10:46 PM >>> `watch` shows only the first 100 log messages - the rest have been truncated...

Before that, the logs show only 5 messages, so the limit of 100 was definitely not hit.

Reproduction Steps

My CDK app is super basic:

import * as cdk from '@aws-cdk/core';
import * as lambda from '@aws-cdk/aws-lambda';
import * as apig from '@aws-cdk/aws-apigateway';

export class HackathonExampleStack extends cdk.Stack {
    constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
        super(scope, id, props);

        const func = new lambda.Function(this, 'NodeJsFunction', {
            // functionName: 'hackathon-function',
            code: lambda.Code.fromAsset(`${__dirname}/lambda-code`),
            runtime: lambda.Runtime.NODEJS_14_X,
            handler: 'index.handler',
        });
        new apig.LambdaRestApi(this, 'RestAPi', {
            handler: func,
        });
        new lambda.Function(this, 'SecondLambdaFunction', {
            code: lambda.Code.fromInline(`
                function handler(_event, _context, callback) {
                    callback(null, 'Success!');
                }

                exports.h = handler;
            `),
            runtime: lambda.Runtime.NODEJS_12_X,
            handler: 'index.h',
        });
    }
}

What did you expect to happen?

Logs would be shown nicely.

What actually happened?

The logs always end with:

[/aws/lambda/HackathonExampleStack-NodeJsFunction6DD2A8DD-adO4KmEjQSuq] 5:10:46 PM >>> `watch` shows only the first 100 log messages - the rest have been truncated...

CDK CLI Version

v1.143.0

Framework Version

v1.143.0

Node.js Version

v16.13.1

OS

MacOS

Language

Typescript

Language Version

3.9.7

Other information

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1package/toolsRelated to AWS CDK Tools or CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions