kratos: Kratos courier: can't evaluate field Identity

Preflight checklist

Describe the bug

I am trying to use Identity in email templates, according to documentation https://www.ory.sh/kratos/docs/concepts/email-sms/#the-identity-attribute.

If I use .Identity in template, process breaks. obraz

Reproducing the bug

  1. Run Kratos without courier.
  2. Run standalone courier.
  3. Mount templates to both Kratos and Courier and use .Identity.
  4. Send email.

Relevant log output

time=2021-11-17T21:11:17Z level=error msg=Unable to get email body from template. audience=application error=map[message:template: verification/valid/email.body.gotmpl:144:167: executing "verification/valid/email.body.gotmpl" at <.Identity.traits.name.first>: can't evaluate field Identity in type *template.VerificationValidModel] message_id=bfa3fcf7-3130-4a0b-861f-3f2168bb9d6e service_name=Ory Kratos service_version=v0.8.0-alpha.3
time=2021-11-17T21:15:46Z level=error msg=Unable to get email body from template. audience=application error=map[message:template: recovery/valid/email.body.gotmpl:144:167: executing "recovery/valid/email.body.gotmpl" at <.Identity.traits.name.first>: can't evaluate field Identity in type *template.RecoveryValidModel] message_id=f59ae8a4-5738-4069-a808-07a7f91ece27 service_name=Ory Kratos service_version=v0.8.0-alpha.3

Relevant configuration

No response

Version

v0.8.0-alpha.3

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Kubernetes

Additional Context

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Yeah it is, tbh I forgot about them. You are right that Helm charts provide a proper way of attaching those templates. Maybe it would be useful to add a sentence to https://www.ory.sh/kratos/docs/concepts/email-sms/#multi-instance, like “If you are using custom email templates, please remember to provide them both to Kratos and courier.”

Accepting PRs 😃

Interesting find! Bugfixes welcomed 😃

One more thing, that is kinda counter intuitive: If separate Kratos courier is used, all templates must be mounted both to Kratos and courier. If templates are mounted only to courier, only HTML template is applied.

Isn’t this done automatically for our helm charts?