Rails EOFError (end of file reached) when saving a devise user

后端 未结 5 906
小鲜肉
小鲜肉 2021-01-03 22:46

I\'m getting this error in production when trying to create a user (i\'m using the devise gem).

EOFError (end of file reached):

I hit this

相关标签:
5条回答
  • 2021-01-03 23:14

    Also! I made this additional mistake and had the same issue: I used my own domain instead of the mail server domain for the "domain" variable.

    Your environment variable should be:

    GMAIL_DOMAIN=gmail.com

    Or for the example above:

    :domain => 'gmail.com',

    0 讨论(0)
  • 2021-01-03 23:15

    I had this issue, and I tried everything and still couldn't figure out what the issue was.

    Let's face it, it's a SH!t message. What I did find though I was running my rails app locally with POW and its actually a POW error.

    When I run rails server and do the same thing that caused the error, I actually got the real error message and was able to find I hadn't setup my controller correctly

    0 讨论(0)
  • 2021-01-03 23:16

    I found one cause for the error here => https://stackoverflow.com/a/40354121/6264112

    But this didn't solve my issue. While I wasn't getting any errors, my emails were still not working through Zoho so I found another solution that works perfectly for my needs...

    1) Connect Zoho to gmail using SMTP. I setup my zoho email as an alias for my personal gmail account so zoho emails are forwarded to gmail and I can reply to them IN gmail FROM my zoho email address. This should be done anyways so you never have to login to zoho. Just do all emailing from gmail.

    2) Connect ActionMailer to gmail account NOT zoho.

    config.action_mailer.smtp_settings = {
        :address                          => 'smtp.gmail.com',
        :port                                 => 587,
        :user_name                     => ENV["gmail_username"],
        :password                       => ENV["gmail_password"],
        :authentication                => :plain,
        :enable_starttls_auto     => true
    }
    

    Now, I just need to specify the to and from values in the mailer like so:

    def notify_admin (message_details)
        @message_details = message_details
        mail(to: "jesse@mydomain.com", subject: "Contact form filled out by: " + message_details[:name], from: message_details[:email])
    end
    

    This works when I want to send emails to myself as is the example above when someone submits the contact form.

    It ALSO works when I want to send an email from my domain such as when they fill out the lead magnet. All I did was switch the to: and from: addresses.

    0 讨论(0)
  • 2021-01-03 23:29

    Here's a working pony gem call.

    Pony.mail({
          :to => 'apotonick@gmail.com',
          subject: "Pony ride",
          body: "Awesome!",
          from: "nick@trb.to", # this MUST be the sending Zoho email.
    
          :via => :smtp,
          :via_options => {
            :address        => 'smtp.zoho.com',
            :port           => '465',
            :enable_starttls_auto => true,
            ssl: true,
            :user_name      => 'nick@trb.to', # MUST be identical to :from.
            :password       => 'yourStrongPw',
            :authentication => :login,
          }
        })
    
    0 讨论(0)
  • 2021-01-03 23:37

    This error was caused by not having my config/initializers/devise.rb specifying the correct email address for config.mailer_sender.

    0 讨论(0)
提交回复
热议问题