在AWS SES模板中使用条件不工作(MissingRenderingAttributeexception)
我试图通过遵循此指南来在SES模板中使用条件: https://dtps://docs.aws.amazon。 com/ses/最新/dg/send-persyalized-email-advanced.html
我应该能够根据可变评估结果的值创建带有动态内容的模板。尽管如此,无论我做什么,我都会遇到“失踪renderingAttributeexception”错误。
对于本地开发,我使用 localstack 在docker上。
aws-localstack
是我设置用于与AWS CLI LOCALSTACK通信的别名,提供了
这是我正在运行的测试:
aws-localstack ses create-template --cli-input-json '{
"Template": {
"TemplateName": "test_conditionals",
"SubjectPart": "TESTING CONDS",
"TextPart": "{{#if lastName}}[{{lastName}}]{{/if}}",
"HtmlPart": "{{#if lastName}}[{{lastName}}]{{/if}}"
}
}'
aws-localstack ses test-render-template --cli-input-json '{
"TemplateName": "test_conditionals",
"TemplateData": "{\"lastName\":\"test-result\"}"
}'
我一直遇到此错误:
在调用testRenderTemplate操作时发生错误(丢失RenderingAttributeexception):属性'#if lastName'不存在于渲染数据中。
我该如何修复?我想念什么?
任何建议都将不胜感激:)
I am trying to use conditionals in SES templates by following this guideline:
https://docs.aws.amazon.com/ses/latest/dg/send-personalized-email-advanced.html
I should be able to create a template with dynamic content based on the value of the variable evaluation result. Still, no matter what I do, I keep getting a 'MissingRenderingAttributeException' error.
For local development I use localstack on docker.
The aws-localstack
is an alias I set for communicating with the AWS CLI localstack provides
This is the test I'm running:
aws-localstack ses create-template --cli-input-json '{
"Template": {
"TemplateName": "test_conditionals",
"SubjectPart": "TESTING CONDS",
"TextPart": "{{#if lastName}}[{{lastName}}]{{/if}}",
"HtmlPart": "{{#if lastName}}[{{lastName}}]{{/if}}"
}
}'
aws-localstack ses test-render-template --cli-input-json '{
"TemplateName": "test_conditionals",
"TemplateData": "{\"lastName\":\"test-result\"}"
}'
I keep getting this error:
An error occurred (MissingRenderingAttributeException) when calling the TestRenderTemplate operation: Attribute '#if lastName' is not present in the rendering data.
How do I fix it? What am I missing?
Any suggestion would be appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了问题,它与AWS无关,但是与LocalStack有关
LocalStack库中缺少许多功能,其中之一是有条件的支持
,我想到了删除此主题所以,因为我必须“努力”才能弄清楚它
I found the problem, it has nothing to do with AWS, but with localstack
There are many features missing in localstack library, one of them is conditionals support
I thought about deleting this topic, but in favor of everyone who expects it to behave the same on local env by using localstack, I thought it is worth having such topic in SO, because I had to work "harder" to figure it out