在 aws-cdk 中总是出现 stack.regionalFact 错误
always getting stack.regionalFact error in aws-cdk
在任何像 cdk-deploy
这样的 cdk 命令上我得到这个错误。我用 cdk innit app --language typescript
创建了这个项目。我的 cdk 版本是 1.121.0
D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\aws-iam\lib\principals.ts:775
return stack.regionalFact(
^
TypeError: Resolution error: Resolution error: Resolution error: Resolution error: stack.regionalFact is not a function.
Object creation stack:
at stack traces disabled.
Object creation stack:
at stack traces disabled..
at ServicePrincipalToken.resolve (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\aws-iam\lib\principals.ts:775:18)
at RememberingTokenResolver.resolveToken (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\resolvable.ts:80:24)
at RememberingTokenResolver.resolveToken (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:286:18)
at resolve (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:212:51)
at Object.resolve [as mapToken] (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:119:77)
at TokenizedStringFragments.mapTokens (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\string-fragments.ts:65:33)
at RememberingTokenResolver.resolveString (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\resolvable.ts:99:22)
at RememberingTokenResolver.resolveString (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:290:23)
at resolve (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:170:48)
at Object.resolve (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:119:77)
Subprocess exited with error 1
我只是用 AppSync 创建一个 graphQl api 并用它调用 lambda 函数。
我通过注释所有代码然后一个一个地取消对每个构造的注释然后 运行 cdk deploy
确定了我的错误发生的位置
所以这是给出错误的构造(当取消注释时,发生错误)
const lambda_function = new lambda.Function(this, "LambdaFucntion", {
runtime: lambda.Runtime.NODEJS_14_X, ///set nodejs runtime environment
code: lambda.Code.fromAsset("lambda"), ///path for lambda function directory
handler: "index.handler", ///specfic fucntion in specific file
// timeout: cdk.Duration.seconds(10), ///Time for function to break. limit upto 15 mins
});
"@aws-cdk/core": "1.121.0"
版本号前缺少^
,导致CDK包版本冲突。其他软件包(带有 carat symbol)已更新到最新的次要版本(上次 运行 npm update
),但 core
停留在 v1.121.0。
在任何像 cdk-deploy
这样的 cdk 命令上我得到这个错误。我用 cdk innit app --language typescript
创建了这个项目。我的 cdk 版本是 1.121.0
D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\aws-iam\lib\principals.ts:775
return stack.regionalFact(
^
TypeError: Resolution error: Resolution error: Resolution error: Resolution error: stack.regionalFact is not a function.
Object creation stack:
at stack traces disabled.
Object creation stack:
at stack traces disabled..
at ServicePrincipalToken.resolve (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\aws-iam\lib\principals.ts:775:18)
at RememberingTokenResolver.resolveToken (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\resolvable.ts:80:24)
at RememberingTokenResolver.resolveToken (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:286:18)
at resolve (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:212:51)
at Object.resolve [as mapToken] (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:119:77)
at TokenizedStringFragments.mapTokens (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\string-fragments.ts:65:33)
at RememberingTokenResolver.resolveString (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\resolvable.ts:99:22)
at RememberingTokenResolver.resolveString (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:290:23)
at resolve (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:170:48)
at Object.resolve (D:\Unicorn\cdk\step03_graphQl\node_modules\@aws-cdk\core\lib\private\resolve.ts:119:77)
Subprocess exited with error 1
我只是用 AppSync 创建一个 graphQl api 并用它调用 lambda 函数。
我通过注释所有代码然后一个一个地取消对每个构造的注释然后 运行 cdk deploy
所以这是给出错误的构造(当取消注释时,发生错误)
const lambda_function = new lambda.Function(this, "LambdaFucntion", {
runtime: lambda.Runtime.NODEJS_14_X, ///set nodejs runtime environment
code: lambda.Code.fromAsset("lambda"), ///path for lambda function directory
handler: "index.handler", ///specfic fucntion in specific file
// timeout: cdk.Duration.seconds(10), ///Time for function to break. limit upto 15 mins
});
"@aws-cdk/core": "1.121.0"
版本号前缺少^
,导致CDK包版本冲突。其他软件包(带有 carat symbol)已更新到最新的次要版本(上次 运行 npm update
),但 core
停留在 v1.121.0。