我在尝试执行以下操作时收到此错误消息cdk deploy PipelineStack:
Webhook could not be registered with GitHub. Error cause: Invalid credentials [StatusCode: 401,
Body: {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}]
(Service: AWSCodePipeline; Status Code: 400; Error Code: ValidationException;
Request ID: dbab7e3e-ed28-42b8-a2d5-7539be32776b; Proxy: null)
Run Code Online (Sandbox Code Playgroud)
为什么我会看到上述错误?
我什至尝试直接验证存储在AWS秘密管理器中的令牌
curl -H "Authorization: token token-stored-in-secretManager" https://api.github.com/users/my-user
Run Code Online (Sandbox Code Playgroud)
并返回200响应。
我的问题类似于How to connect github repo with aws using cdk?
顺便说一句,我的 github 存储库设置为私有而不是公开。不确定这是否重要。
这是我的源代码阶段的 CDK 代码。
Webhook could not be registered with GitHub. Error cause: Invalid credentials [StatusCode: 401,
Body: {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}]
(Service: AWSCodePipeline; …Run Code Online (Sandbox Code Playgroud) 我正在使用打字稿。
我有一个这样定义的类型:
export type SearchStoresParameters = {
storeCategory : string;
latitude: number;
longitude: number;
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试将上述类型对象转换为查询字符串。
export const searchStores = async (searchStoresParameters : SearchStoresParameters ) => {
var queryString = Object.keys(searchStoresParameters).map((key) => {
return encodeURIComponent(key) + '=' + encodeURIComponent(searchStoresParameters[key])
}).join('&');
const searchStoresApi = process.env.REACT_APP_BACKEND_SERVICE_API + "/stores?" + queryString;
const res = await fetch(
searchStoresApi,
);
const response = await res.json();
}
Run Code Online (Sandbox Code Playgroud)
但是,上面的代码显示错误:
(parameter) searchStoresParameters: SearchStoresParameters
Element implicitly has an 'any' type because expression of type 'string' can't be used to …Run Code Online (Sandbox Code Playgroud) 我正在将 CDK 包的相对路径导入切换为绝对路径导入,并在运行时出现此错误cdk synth:
$ cdk synth
Error: Cannot find module 'lib/CodePipelineStack'
Run Code Online (Sandbox Code Playgroud)
我按照此方法使用打字稿中的绝对路径进行导入以设置文件中的baseUrl和。pathstsconfig.json
不知道为什么它不起作用。
我的项目结构如下所示:
我的 tsconfig.json 是:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"bin/*": [ "./bin/*" ],
"lib/*": [ "./lib/*" ],
"test/*": [ "./test/*" ]
},
"target": "ES2018",
"module": "commonjs",
"lib": [
"es2018"
],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": …Run Code Online (Sandbox Code Playgroud) 我有一个创建了 S3Bucket 的 ApplicationStack:
export class ApplicationStack extends Cdk.Stack {
public readonly websiteBucket : S3.Bucket;
constructor(scope: Construct, id: string, props: ApplicationStackProps) {
super(scope, id, props);
// Amazon S3 bucket to host the store website artifact
this.websiteBucket = new S3.Bucket(this, "eCommerceWebsite", {
bucketName: `${props.websiteDomain}-${account}-${region}`,
websiteIndexDocument: "index.html",
websiteErrorDocument: "error.html",
removalPolicy: Cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true,
accessControl: S3.BucketAccessControl.PRIVATE,
encryption: S3.BucketEncryption.S3_MANAGED,
publicReadAccess: false,
blockPublicAccess: S3.BlockPublicAccess.BLOCK_ALL,
});
// Create a dummy export.
// https://www.endoflineblog.com/cdk-tips-03-how-to-unblock-cross-stack-references
this.exportValue(this.websiteBucket.bucketArn);
...
...
...
}
}
Run Code Online (Sandbox Code Playgroud)
我还定义了ApplicationStage上面包含的内容ApplicationStack
export class ApplicationStage …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation aws-codepipeline aws-cdk