ankane / ahoy_email

First-party email analytics for Rails
MIT License
1.11k stars 137 forks source link

"Link expired" for all links in the email #157

Closed thebravoman closed 2 years ago

thebravoman commented 2 years ago

ahoy_email 2.1.2

I send an email. After the email is sent and we click on the links in the email the result on the page states "Link expired".

Not even a delay. Happens only on production. Can not figure out how to even debug it.

Tested it with ahoy_email 2.1.1 and it still occurs.

It is interesting that it occurs only on production.

thebravoman commented 2 years ago

Found it. It is not ahoy. It is the service that we use which is mailinator.

Gmail

Link in gmail:

https://www.fllcasts.com/email_tracking/click?c=digest&s=7U7ZATxq7CvM0nya6XiP0tw030j7FUld8L-rU6TBc7E&t=rN3wOKTnqgYSKucgJTjk5niS8qdj9Fmv&u=https%3A%2F%2Fwww.fllcasts.com%2Fcourses%2F215-first-lego-league-2020-replay-solutions-and-review-with-robot-inventor%3Futm_campaign%3Ddigest-422%26utm_medium%3Ddigest-auto%26utm_source%3Ddigest

Request to the server

2022-05-23T18:49:26.816410+00:00 heroku[router]: at=info method=GET path="/email_tracking/click?c=digest&s=7U7ZATxq7CvM0nya6XiP0tw030j7FUld8L-rU6TBc7E&t=rN3wOKTnqgYSKucgJTjk5niS8qdj9Fmv&u=https%3A%2F%2Fwww.fllcasts.com%2Fcourses%2F215-first-lego-league-2020-replay-solutions-and-review-with-robot-inventor%3Futm_campaign%3Ddigest-422%26utm_medium%3Ddigest-auto%26utm_source%3Ddigest"

Status

Everything works

Mailinator

Link in mailinator

https://www.mailinator.com/linker?linkid=b8a8b8e4-3963-4b8f-83a0-c3cfc50ef33d

Request to the server

2022-05-23T18:50:48.526992+00:00 heroku[router]: at=info method=GET path="/email_tracking/click?c=digest&s=lzNxbJZ6hXJXlW0kP6sKC0pIo47lmxv27OPVAR4DXpY&t=eMYjNF8lu3eqDmMKqko0rgujrPOCiUXT&u=https://www.fllcasts.com/courses/215-first-lego-league-2020-replay-solutions-and-review-with-robot-inventor?utm_campaign=digest-422&utm_medium=digest-auto&utm_source=digest"

Status

"Link expired"

It seems that the mail service decoded the u param and this causes the signature to fail.

thebravoman commented 2 years ago

A good suggestion here could be to have "signature not correct" instead of "Link expired" as it was an incorrect signature that was causing the problem.

ankane commented 2 years ago

Glad you figured it out. fwiw, the message is designed for users rather than developers (for instance, if you change your application's secret key, existing links will "expire").