Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Campaign preview fails when using TrackLink variable with dynamic template variables #1520

Closed
tkempken opened this issue Sep 12, 2023 · 3 comments
Labels
question Further information is requested

Comments

@tkempken
Copy link

Version:

  • listmonk: v2.5.1 (a6a2b69 2023-08-15T15:49:28Z, linux/amd64)
  • OS: Docker / Ubuntu

Description of the bug and steps to reproduce:
The campaign preview fails with error below once using dynamic template variables in combination with TrackLink handler. The generated mails are correct and track link is working fine too. Just the preview fails.

Screenshots:
image

{"message":"Error rendering message: template: content:222:182: executing \"content\" at \u003c.Subscriber.Attribs.app_media_url\u003e: invalid value; expected string"}

Raw HTML Template Code:
<a href="{{ TrackLink .Subscriber.Attribs.app_media_url }}"

image

There might be a relation with #667 . Based on the reply of @knadh we used the TrackLink handler like the given example.

<a href="{{ TrackLink .Subscriber.Attribs.jobs.link }}">View</a> works in d2cf6e0. This will be available in the upcoming release.

@tkempken tkempken added the bug Something isn't working label Sep 12, 2023
@knadh
Copy link
Owner

knadh commented Sep 18, 2023

I tried this locally and it works. <a href="{{ TrackLink .Subscriber.Attribs.app_media_url }}">Test</a>. However, it fails when app_media_url isn't present. If you are unable to ensure that this field is present for all subscribers, you could put it in a {{ if .Subscriber.Attribs.app_media_url }} check instead.

@knadh knadh closed this as completed Sep 18, 2023
@knadh knadh added question Further information is requested and removed bug Something isn't working labels Sep 18, 2023
@tkempken
Copy link
Author

Hi, this works on delivery. But is preview working for you? The preview hasn't the variable set - as usual.

@knadh
Copy link
Owner

knadh commented Sep 18, 2023

Yes, it works in the preview too. Preview picks up a random subscriber from the mailing list and as long as they have the attribute value set, it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants