Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

❗ NOTICE: aws-cdk-lib: Resolution error: Cannot find module '../../region-info/build-tools/fact-tables' #31492

Closed
1 task
ajaylamba-provar opened this issue Sep 19, 2024 · 13 comments Β· Fixed by #31496
Assignees
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud aws-cdk-lib Related to the aws-cdk-lib package bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0

Comments

@ajaylamba-provar
Copy link

ajaylamba-provar commented Sep 19, 2024

Please add your +1 πŸ‘ to let us know you have encountered this

Status:

RESOLVED

Released fix in version v2.159.1

Overview:

cdk build failure in stacks due to incorrect export of '../../region-info/build-tools/fact-tables'

Complete Error Message:

On running command npx cdk synth

Error: Resolution error: Resolution error: Resolution error: Cannot find module '../../region-info/build-tools/fact-tables'
Require stack:
`- /Documents/GitHub/test/node_modules/aws-cdk-lib/aws-ec2/lib/vpc-endpoint.js

  • /Documents/GitHub/test/node_modules/aws-cdk-lib/aws-ec2/lib/index.js
  • /Documents/GitHub/test/node_modules/aws-cdk-lib/aws-ec2/index.js
  • /Documents/GitHub/test/lib/vpc-stack.ts`

Versions:
"aws-cdk-lib": "^2.159.0",

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

2.158.0

Expected Behavior

The synth operation should be successful without any error.

Current Behavior

The synth command is getting failed with the error:
Error: Resolution error: Resolution error: Resolution error: Cannot find module '../../region-info/build-tools/fact-tables'
Require stack:

Workaround:

Pin CDK version to 2.158.0

Solution:

Revert PR #31496

Reproduction Steps

Create a VPC stack by using import statement as import * as ec2 from 'aws-cdk-lib/aws-ec2';

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.159.0

Framework Version

No response

Node.js Version

18.17.0

OS

MacOS

Language

TypeScript

Language Version

No response

Other information

No response

@ajaylamba-provar ajaylamba-provar added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 19, 2024
@github-actions github-actions bot added the aws-cdk-lib Related to the aws-cdk-lib package label Sep 19, 2024
@ajaylamba-provar
Copy link
Author

After inspecting the node_modules folder of the project, I found that build-tools folder is not present inside aws-cdk-lib/region-info

@nelsonsilva-code
Copy link

nelsonsilva-code commented Sep 19, 2024

I have also encountered this issue, and can confirm that this is only happening in 2.159.0, since my builds started breaking after the last package publishing.

Temporary solution: Pin to 2.158.0 or prior

@shani-asad
Copy link

I'm also experiencing this issue

@ajaylamba-provar
Copy link
Author

Pinning to version 2.158.0 works, thanks @nelsonsilva-code

@pahud
Copy link
Contributor

pahud commented Sep 19, 2024

Taking a look

@pahud pahud self-assigned this Sep 19, 2024
@pahud pahud added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Sep 19, 2024
@pahud
Copy link
Contributor

pahud commented Sep 19, 2024

Can't reproduce it.

cdk init a new empty project using 2.159.0 with

import * as cdk from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import { Construct } from 'constructs';
// import * as sqs from 'aws-cdk-lib/aws-sqs';

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

    new ec2.Vpc(this, 'MyVpc');
  }
}

npx cdk synth works to me.

 % ls node_modules/aws-cdk-lib/region-info 
README.md       index.d.ts      index.js        lib

I found that build-tools folder is not present inside aws-cdk-lib/region-info

Yes! I noticed it. But I think build-tools should not be there. It's not installed in 2.158.0 as well.

still investigating

@esteban-ricalde-mysa
Copy link

Ran into the same issue. Pinning to version 2.158.0 worked for me too

@pahud
Copy link
Contributor

pahud commented Sep 19, 2024

For those having this issue:
@esteban-ricalde-mysa @ajaylamba-provar @shani-asad @nelsonsilva-code

Are you having the same error indicating fact-tables is missing?

Error: Resolution error: Resolution error: Resolution error: Cannot find module '../../region-info/build-tools/fact-tables'

@esteban-ricalde-mysa
Copy link

@pahud Yes, exactly the same error

@pahud
Copy link
Contributor

pahud commented Sep 19, 2024

OK reproducible.

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

    // create a random vpc endpoint for a new vpc
    const vpc = new ec2.Vpc(this, 'vpc', {
      maxAzs: 2,
      natGateways: 1,
    });
    const securityGroup = new ec2.SecurityGroup(this, 'sg', { vpc });
    securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(443));
    const endpoint = vpc.addInterfaceEndpoint('endpoint', {
      service: ec2.InterfaceVpcEndpointAwsService.EC2,
      securityGroups: [securityGroup],
    });
  }
}

root cause could be - 95c49ab

@pahud pahud added p0 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 19, 2024
@shikha372 shikha372 added management/tracking Issues that track a subject or multiple issues @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud labels Sep 19, 2024
@shikha372 shikha372 pinned this issue Sep 19, 2024
@pahud pahud removed their assignment Sep 19, 2024
@mergify mergify bot closed this as completed in #31496 Sep 19, 2024
@mergify mergify bot closed this as completed in 17be13f Sep 19, 2024
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2024
@pahud pahud changed the title aws-cdk-lib: Resolution error: Cannot find module '../../region-info/build-tools/fact-tables' ❗ NOTICE: aws-cdk-lib: Resolution error: Cannot find module '../../region-info/build-tools/fact-tables' Sep 19, 2024
@pahud pahud removed the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Sep 19, 2024
@shikha372
Copy link
Contributor

shikha372 commented Sep 19, 2024

Fix is now released as part of v2.159.1

@moelasmar moelasmar unpinned this issue Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud aws-cdk-lib Related to the aws-cdk-lib package bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants