Prometheus
Prometheus

Reputation: 889

Ruby On Rails: Sign up error using devise & sendgrid

UPDATE:

Now i get only on heroku (locally everything works fine) the following error:

    2017-02-08T17:32:19.012088+00:00 app[web.1]:
2017-02-08T17:32:19.012090+00:00 app[web.1]: MyMailer#new_user: processed outbou                                  nd mail in 0.6ms
2017-02-08T17:32:19.012890+00:00 app[web.1]:    (0.6ms)  ROLLBACK
2017-02-08T17:32:19.013352+00:00 app[web.1]: Completed 500 Internal Server Error                                   in 152ms (ActiveRecord: 10.9ms)
2017-02-08T17:32:19.015070+00:00 app[web.1]:
2017-02-08T17:32:19.015072+00:00 app[web.1]: TypeError (no implicit conversion o                                  f nil into String):
2017-02-08T17:32:19.015073+00:00 app[web.1]:   app/mailers/my_mailer.rb:4:in `ne                                  w'
2017-02-08T17:32:19.015073+00:00 app[web.1]:   app/mailers/my_mailer.rb:4:in `se                                  ndgrid_client'
2017-02-08T17:32:19.015073+00:00 app[web.1]:   app/mailers/my_mailer.rb:31:in `n                                  ew_user'
2017-02-08T17:32:19.015074+00:00 app[web.1]:   app/models/user.rb:7:insend_not                                  ification'
2017-02-08T17:32:19.015074+00:00 app[web.1]:

Upvotes: 0

Views: 176

Answers (1)

Vincent Nguyen
Vincent Nguyen

Reputation: 311

The problem appears when you init a new SendGrid client (line 3)

Here is my example

2.2.2 :005 > SendGrid::API.new('xxxxxxxxxx')
ArgumentError: wrong number of arguments (1 for 0)

According to the sendgrid-ruby gem documentation, the code should be SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY']).

2.2.2 :004 > sg = SendGrid::API.new(api_key: 'xxxxxxxxxx')
 => #<SendGrid::API:0x007fde228f06d0 @api_key="xxxxxxxxxx", @host="https://api.sendgrid.com", @version="v3", @user_agent="sendgrid/4.0.7;ruby", @request_headers={"Authorization"=>"Bearer xxxxxxxxxx", "Accept"=>"application/json"}, @client=#<SendGrid::Client:0x007fde228f0360 @host="https://api.sendgrid.com/v3", @request_headers={"Authorization"=>"Bearer xxxxxxxxxx", "Accept"=>"application/json"}, @version=nil, @url_path=[], @methods=["delete", "get", "patch", "post", "put"], @query_params=nil, @request_body=nil>>

Upvotes: 1

Related Questions