Connection #0 to host xxxx.execute-api.eu-central-1.amazonaws.com left intact
{"message": "Internal server error"}%
'''
为什么我从 OPTIONS 方法中收到 500 内部服务器错误? 我缺少什么?
这是我在 CDK 中对 REST API 和 S3 集成的定义(打字稿)
'''
private createS3Integration(documentsBucket: IBucket, executeRole: Role) {
return new apigw.AwsIntegration({
service: 's3',
integrationHttpMethod: 'GET',
path: '{bucket}',
options: {
credentialsRole: executeRole,
integrationResponses: [
{
statusCode: '200',
responseParameters: {
'method.response.header.Content-Type': 'integration.response.header.Content-Type'
},
}
],
requestParameters: {
'integration.request.path.bucket': 'method.request.path.folder'
},
},
});
}
private addDocumentsGetEndpoint(apiGateway: apigw.RestApi, s3GetIntegration: apigw.AwsIntegration) {
apiGateway
.root
.addResource('{folder}')
.addMethod('GET', s3GetIntegration, {
methodResponses: [
{
statusCode: '200',
responseParameters: {
'method.response.header.Content-Type': true
},
},
],
requestParameters: {
'method.request.path.folder': true,
'method.request.header.Content-Type': true
},
});
}
'''