Skip to content

(node: @aws-cdk/region-info): using latest version of @aws-cdk/region-info throws an "Cannot find module 'aws-cdk-lib/core/lib/errors'" error #34690

@HappyZombies

Description

@HappyZombies

Describe the bug

I have been using version 2.115.0 of @aws-cdk/region-info and decided to update to the latest version, that being 2.200.1.

However, upon simply running my project I got this error immediately.

Error: Cannot find module 'aws-cdk-lib/core/lib/errors'

I made this simple script to show that it is not working at all.

package.json (or simply just run npm i @aws-cdk/region-info

{
  "name": "aws-testing",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "N/A",
  "description": "",
  "dependencies": {
    "@aws-cdk/region-info": "^2.200.1"
  }
}

Simple code:

const { Fact, FactName } = require("@aws-cdk/region-info");

const isValidRegion = (region) => {
    const myRegion = Fact.find(region, FactName.DOMAIN_SUFFIX);
    return myRegion !== undefined && myRegion !== null;
}

(() => {
    console.log(isValidRegion("us-west-2"));
})();

Using latest version results in the error I mentioned, if you use version 2.115.0 then this script works and returns true

Regression Issue

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

Last Known Working CDK Library Version

For module @aws-cdk/region-info, v2.115.0

Expected Behavior

That it doesn't crash on use.

Current Behavior

It crashes completely due to not being able to find a module.

Reproduction Steps

Simply npm i @aws-cdk/region-info and try to use it.

Possible Solution

No response

Additional Information/Context

https://www.npmjs.com/package/@aws-cdk/region-info

AWS CDK Library version (aws-cdk-lib)

N/A

AWS CDK CLI version

N/A

Node.js Version

v22.14.0

OS

MacOS

Language

TypeScript

Language Version

N/A (not using TypeScript)

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/region-infoRelated to AWS Region informationbugThis issue is a bug.effort/mediumMedium work item – several days of effortp1potential-regressionMarking this issue as a potential regression to be checked by team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions