在AWS SES模板中使用条件不工作(MissingRenderingAttributeexception)

发布于 2025-01-30 23:42:34 字数 1239 浏览 5 评论 0原文

我试图通过遵循此指南来在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云归处 2025-02-06 23:42:34

我发现了问题,它与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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文