【发布时间】:2021-12-06 14:22:27
【问题描述】:
我一直在试图了解如何克服这个错误:
Property validation failure: [Value of property {/RequestParameters/MessageAttributes} does not match type {String}]
有问题的云形成资源是这样的:
HttpApiPayloadRouteIntegration:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId: !Ref HttpApi
Description: Proxy incoming HTTP Payload into SQS
IntegrationType: AWS_PROXY
IntegrationSubtype: SQS-SendMessage
PayloadFormatVersion: "1.0"
CredentialsArn: !GetAtt HttpApiRole.Arn
RequestParameters:
QueueUrl: !Ref HTTPApiEventQueue
MessageBody: $request.body
MessageGroupId: $request.body.repository.full_name
MessageDeduplicationId:
!Join [
"-",
[$request.body.repository.full_name, $request.body.alert.number],
]
MessageAttributes:
- firstAttribute:
DataType: String
StringValue: hello world
- secondAttribute:
DataType: String
StringValue: goodbye world
错误发生在这里:
MessageAttributes:
- firstAttribute:
DataType: String
StringValue: hello world
- secondAttribute:
DataType: String
StringValue: goodbye world
我试过了:
MessageAttributes:
firstAttribute:
DataType: String
StringValue: hello world
secondAttribute:
DataType: String
StringValue: goodbye world
MessageAttributes:
- firstAttribute:
DataType: String
StringValue: hello world
- secondAttribute:
DataType: String
StringValue: goodbye world
MessageAttributes:
firstAttribute:
Name: firstAttribute
Type: String
Value: hello world
secondAttribute:
Name: secondAttribute
Type: String
Value: goodbye world
我的问题是真的。如何在 yaml 云形成模板中发送 MessageAttributes?
【问题讨论】:
标签: amazon-web-services yaml amazon-cloudformation amazon-sqs amazon-api-gateway