2017-02-05 11 views
0

UPDATE使用してエラーをサインアップ:あなたはinitの際に問題が表示されますルビーオンレール:工夫&sendgrid

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]: 

答えて

1

を今私が唯一のHerokuの(ローカルですべてが正常に動作します)、次のエラーに乗りますここでは新しいSendGridクライアント(ライン3)

は私の例である

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

012によると、gemのドキュメントでは、コードは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>> 
+0

あなたは、上司です!それはついに働いています。 – Prometheus

+0

または実際にはありません。私は今、英雄だけに新しい問題を持っています。ローカルではすべて動作し、私は質問を更新しました。これが役立つ場合は、 – Prometheus

+0

あなたのコードを教えてもらえますか? 'api_key'の値を確認できますか?私はこのキーが現在nullを返すと思います。 –