Skip to content

Commit 4a75032

Browse files
committed
fix: export errors to make it available in region-info/lib/fact.ts (#34691)
### Issue #34690 Closes #34690 ### Reason for this change PR #33384 released in version `2.200.1` of `@aws-cdk/region-info` imported `UnscopedValidationError` from `aws-cdk-lib/core/lib/errors`, but did not export `errors.js` properly from `aws-cdk-lib`. This resulted in the following error message when attempting to `import { Fact } from '@aws-cdk/region-info'` (`fact.ts` imports `UnscopedValidationError`). ``` ❯ node test.js node:internal/modules/cjs/loader:1228 throw err; ^ Error: Cannot find module 'aws-cdk-lib/core/lib/errors' Require stack: - /Volumes/workplace/test-region-info-app/node_modules/@aws-cdk/region-info/lib/fact.js - /Volumes/workplace/test-region-info-app/node_modules/@aws-cdk/region-info/lib/index.js - /Volumes/workplace/test-region-info-app/test.js at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15) at Module._load (node:internal/modules/cjs/loader:1051:27) at Module.require (node:internal/modules/cjs/loader:1311:19) at require (node:internal/modules/helpers:179:18) at Object.<anonymous> (/Volumes/workplace/test-region-info-app/node_modules/@aws-cdk/region-info/lib/fact.js:8:18) at Module._compile (node:internal/modules/cjs/loader:1469:14) at Module._extensions..js (node:internal/modules/cjs/loader:1548:10) at Module.load (node:internal/modules/cjs/loader:1288:32) at Module._load (node:internal/modules/cjs/loader:1104:12) at Module.require (node:internal/modules/cjs/loader:1311:19) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Volumes/workplace/test-region-info-app/node_modules/@aws-cdk/region-info/lib/fact.js', '/Volumes/workplace/test-region-info-app/node_modules/@aws-cdk/region-info/lib/index.js', '/Volumes/workplace/test-region-info-app/test.js' ] } Node.js v20.17.0 ``` ### Description of changes Exported `errors.js` from `packages/aws-cdk-lib/package.json`, which makes it available to `@aws-cdk/region-info`. ### Describe any new or updated permissions being added None. ### Description of how you validated changes Tested by hand after making this code change, using example code from the linked issue. ### Checklist - [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent a10b089 commit 4a75032

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/aws-cdk-lib/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@
506506
"./core/lib/helpers-internal": "./core/lib/helpers-internal/index.js",
507507
"./core/lib/metadata-resource": "./core/lib/metadata-resource.js",
508508
"./core/lib/prop-injectable": "./core/lib/prop-injectable.js",
509+
"./core/lib/errors": "./core/lib/errors.js",
509510
"./custom-resources": "./custom-resources/index.js",
510511
"./custom-resources/lib/helpers-internal": "./custom-resources/lib/helpers-internal/index.js",
511512
"./cx-api": "./cx-api/index.js",

0 commit comments

Comments
 (0)