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

Issue validating invite token #6255

Closed
ajubin opened this issue May 15, 2023 · 8 comments
Closed

Issue validating invite token #6255

ajubin opened this issue May 15, 2023 · 8 comments

Comments

@ajubin
Copy link

ajubin commented May 15, 2023

Describe the bug
I've just launched an instance of n8n on Heroku using this deployment process https://github.com/muzzo-tech/n8n-heroku/

Before inviting user, I setup SMTP with Sendgrid

Then I invited user, they received the mail, but when they clicked on the link to create their account, they saw this error
image

The workaround I found is to copy/paste the link in the invite email instead of clicking on it. Then they can create their account with no error

Expected behavior
When I click on the link, I can create an account with no error

Environment (please complete the following information):

  • OS: heroku basic dyno
  • n8n Version: 0.226.2
  • Node.js Version [e.g. 16.17.0]
  • Database system: psql
  • Operation mode: 'own'

Additional context
Maybe sendgrid add additionnal tracking on links that strips some info in the link

@Joffcom
Copy link
Member

Joffcom commented May 15, 2023

Hey @ajubin,

Is there any difference between the link copied manually and the link clicked?

@Joffcom
Copy link
Member

Joffcom commented May 19, 2023

Hey @ajubin,

Did you have a chance to check this? I have just given it a test on my local install and it is working as expected.

@ajubin
Copy link
Author

ajubin commented May 22, 2023

Hello, I forgot to hit the send button, sorry 🥺

Indeed I do have a difference in the link copied manually and the link clicked.

  • The link copied looks like: https://<my-n8n-instance>/signup?inviterId=<inviter-uuid>&inviteeId=<invitee-uuid>
  • and the link clicked looks like: http://url4900.<my-domain>/ls/click?upn=<a-very-long-token> that redirects to
    https://<my-n8n-instance>//signup?inviterId&&utm_source=sendgrid.com&utm_medium=e-mail&utm_campaign=website#x3D;<inviter-uuid>&inviteeId=<invitee-uuid>

So it seems that sendgrid is messing up with the URL Params. There's should be a settings on their side to disable URL tracking and shortening or maybe there's something wrong with their URL params replacement

[EDIT]
To disable sentry tracking, a special attributes should be added as mentionned here https://stackoverflow.com/a/43145800

@Joffcom
Copy link
Member

Joffcom commented May 22, 2023

Hey @ajubin,

I have had a chat internally and it looks like that parameter is only for Sendgrid and if we make the change to work around an issue with their tracking we would also open the doors to implement similar one off changes for other providers in the future.

Instead a better solution would be to use custom email templates which can be done with N8N_UM_EMAIL_TEMPLATES_INVITE and N8N_UM_EMAIL_TEMPLATES_PWRESET this then allows you to change the template to work around provider specific issues.

Let me know if you have any questions about this one, You can find more information on those 2 options here: https://docs.n8n.io/hosting/environment-variables/environment-variables/#user-management-and-smtp and the default templates we use are here: https://github.com/n8n-io/n8n/tree/master/packages/cli/src/UserManagement/email/templates

@ajubin
Copy link
Author

ajubin commented May 22, 2023

Ok, I understand the reason, sadly there is no convention to disable tracking on email :)

I created gists here https://gist.github.com/ajubin/ddacbd212f231ef58c5f00c2d239cd76 to host html templates

[EDIT] I've added the following env var N8N_UM_EMAIL_TEMPLATES_INVITE=https://gist.githubusercontent.com/ajubin/ddacbd212f231ef58c5f00c2d239cd76/raw/2c6ff6a5cdd496f5f7d46abdca4430ff343b9094/invite.html but it don't seem to use the provided template, I removed the comma after the "Hi there" but can't see the change in invite mail.

According to this file packages/cli/src/UserManagement/email/UserManagementMailer.ts it seems that I should host the file on the same computer as n8n

I'm running this on heroku with 1-click deploy, I don't know if I can but I guess this is out of your scope now

@Joffcom
Copy link
Member

Joffcom commented May 22, 2023

Hey @ajubin,

You would need to store the files locally to the container, if Heroku allows files you could mount a volume to the container and you should be good to go.

@Joffcom
Copy link
Member

Joffcom commented Jun 16, 2023

Hey @ajubin,

I am going to mark this as closed for now, Hopefully you have your templates working now.

@Joffcom Joffcom closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2023
@ajubin
Copy link
Author

ajubin commented Jun 22, 2023

thanks again :)

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

No branches or pull requests

2 participants