Coder Social home page Coder Social logo

Email bodies are blank about sentinel HOT 8 CLOSED

britton-jb avatar britton-jb commented on July 29, 2024
Email bodies are blank

from sentinel.

Comments (8)

britton-jb avatar britton-jb commented on July 29, 2024 1

Unfortunately this is definitely a bug that I need to fix and include a spec for, based on my testing. Thanks for letting me know, and I'm glad you were able to find a workaround in the meantime.

from sentinel.

britton-jb avatar britton-jb commented on July 29, 2024

Thanks for sending this my way. I'll see if I can take a look at it in the next couple days.

Depending on if you need API support or not you may also want to look at Coherence.

from sentinel.

MatthewRDodds avatar MatthewRDodds commented on July 29, 2024

Thanks! I was hoping it was just a configuration problem. I might go back to where the email is converted to html/text and see whether that's where it fails, will update here with what I find.

from sentinel.

MatthewRDodds avatar MatthewRDodds commented on July 29, 2024

I used iex to pry inside of confirmable_and_invitable and set up the context to render the template, this is what that looked like:

email = Mailer.send_invite_email(updated_user, {confirmation_token, password_reset_token})
template = email.private.view_template
assigns = email.assigns
IEx.pry

I noticed in the source for bamboo that the template is rendered this way Phoenix.View.render_to_string(email.private.view_module,template,assigns)

So I did that used that to try the render, which gave the this stack-trace:

** (Protocol.UndefinedError) protocol Phoenix.Param not implemented for []
     (phoenix) lib/phoenix/param.ex:125: Phoenix.Param.Any.to_param/1
    (myapp) web/router.ex:1: MyApp.Router.Helpers.user_path/4
    (myapp) web/router.ex:1: MyApp.Router.Helpers.user_url/4
    (sentinel) lib/sentinel/templates/email/invite.html.eex:6: Sentinel.EmailView."invite.html"/1
     (phoenix) lib/phoenix/view.ex:335: Phoenix.View.render_to_iodata/3
     (phoenix) lib/phoenix/view.ex:342: Phoenix.View.render_to_string/3
      (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
         (iex) lib/iex/evaluator.ex:135: IEx.Evaluator.handle_eval/6
         (iex) lib/iex/evaluator.ex:128: IEx.Evaluator.do_eval/4
         (iex) lib/iex/evaluator.ex:108: IEx.Evaluator.eval/4
         (iex) lib/iex/evaluator.ex:27: IEx.Evaluator.loop/3
         (iex) lib/iex/evaluator.ex:18: IEx.Evaluator.init/3
         (iex) lib/iex.ex:439: IEx.pry/3

After looking in the invite.html template I copied this line into iex which resulted in the same stacktrace, so that seems to be the source of my problem:

Sentinel.RouterHelper.helpers.user_url(Sentinel.RouterHelper.endpoint, :invited)

from sentinel.

MatthewRDodds avatar MatthewRDodds commented on July 29, 2024

I was able to solve of that error by changing my invited path in my router from get "/users/:id/invited", UserController, :invited to get "/users/invited", UserController, :invited. Now the template renders, but still without any invite link:

pry(1)> Phoenix.View.render_to_string(email.private.view_module,template,assigns)
"<p>Hello [email protected]!</p>\n\n<p>You've been invited to MyApp</p>\n"

from sentinel.

britton-jb avatar britton-jb commented on July 29, 2024

@MatthewRDodds sorry about the delay, I haven't forgotten about this. My schedule has finally permitted me to take a look. I'm able to replicate the issue, and I'm working on a fix for it. Unfortunately as you can likely guess I don't have a timeframe on it just yet.

from sentinel.

MatthewRDodds avatar MatthewRDodds commented on July 29, 2024

No worries, thanks for the update @britton-jb! I ended up going ahead and writing my own app specific invite routine. Maybe it was something to do with my local configuration or implementation, in that case it might be good to close this for now and see if other people have trouble.

from sentinel.

britton-jb avatar britton-jb commented on July 29, 2024

Fixed in the v2 branch, which should have a 2.0.0 release in the coming week.

from sentinel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.