aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.57k stars 3.88k forks source link

(cdk migrate): process.stdout.clearLine is not a function #29173

Open Lock128 opened 7 months ago

Lock128 commented 7 months ago

Describe the bug

Trying to execute cdk migrate in automation - e.g. CodeCatalyst workflow - fails

Similar issue to this one: here

Expected Behavior

I'd expect the workflow to complete but to log the errors or challenges.

Current Behavior

Workflow fails with this error: This command is an experimental feature. Using the latest successful scan which is 0 days, 3 hours, and 19 minutes old. No filters provided. Retrieving all resources from scan. finding related resources. Found 62 resources. Generating CFN template from scanned resources. Please wait, template creation in progress. This may take a couple minutes. ❌ Migrate failed for myCloudFormationStack: process.stdout.clearLine is not a function

process.stdout.clearLine is not a function

Reproduction Steps

Execute cdk migrate in the codecatalyst workflow

Possible Solution

use a logging framework instead of process.stdout - or maybe find a different way?

Additional Information/Context

I am trying to execute cdk migrate in the context of a CodeCatalyst Workflow

https://github.com/aws/aws-cdk/blame/da0b82c21e1ddd3c301db8f98e39767e07ff32fc/packages/aws-cdk/lib/commands/migrate.ts#L449

CDK CLI Version

latest

Framework Version

No response

Node.js Version

16

OS

linux

Language

TypeScript

Language Version

No response

Other information

No response

pahud commented 7 months ago

Thanks for reporting. We'll track and bring this to the maintainer.

alexforsyth commented 7 months ago

Are you able to post your workflow? (or the relevant portions of it?)

Lock128 commented 7 months ago

Of course

Name: Workflow_5b48
SchemaVersion: "1.0"

# Optional - Set automatic triggers.
Triggers:
  - Type: PUSH
    Branches:
      - main

# Required - Define action configurations.
Actions:
  Build_69:
    # Identifies the action. Do not modify this value.
    Identifier: aws/build@v1.0.0
    # Specifies the source and/or artifacts to pass to the action as input.
    Inputs:
      # Optional
      Sources:
        - WorkflowSource # This specifies that the action requires this Workflow as a source
    Outputs:
      # Optional; Automatically discover reports for popular test frameworks
      AutoDiscoverReports:
        Enabled: true
        # Use as prefix for the report files
        ReportNamePrefix: rpt
    # Defines the action's properties.
    Configuration:
      # Required - Steps are sequential instructions that run shell commands
      Steps:
        - Run: npm install -g aws-cdk
        - Run: echo "Hello, World!"
        - Run: cdk migrate --from-scan --stack-name "myCloudFormationStack"
    Compute:
      Type: Lambda
    Environment:
      Connections:
        - Role: CodeCatalystWorkflowDevelopmentRole-AWS-Heroes
          Name: johannes-servicetests
      Name: servicetests