-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(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 #36399
Copy link
Copy link
Closed
Labels
@aws-cdk/region-infoRelated to AWS Region informationRelated to AWS Region informationbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp1potential-regressionMarking this issue as a potential regression to be checked by team memberMarking this issue as a potential regression to be checked by team member
Description
Describe the bug
This already has been reported in issue #34690.
While using @aws-cdk/region-info v2.232.2, we get this error:
Error: Cannot find module 'aws-cdk-lib/core/lib/errors'
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Library Version
2.199.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
package.json
{
"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.232.2"
}
}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("eu-west-1"));
})();Using latest version results in the error I mentioned, if you use version 2.199.0 then this script works and returns true.
Possible Solution
Either replace the UnscopedValidationError with Error instance or publish the error classes as a library to each package management.
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.232.2
AWS CDK CLI version
2.232.2
Node.js Version
22.21.1
OS
MacOS 26.0.1
Language
TypeScript
Language Version
No response
Other information
I have not confirmed it, but I assume the same error will affect @aws-cdk/cx-api.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/region-infoRelated to AWS Region informationRelated to AWS Region informationbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp1potential-regressionMarking this issue as a potential regression to be checked by team memberMarking this issue as a potential regression to be checked by team member