sendgrid / eventkit-rails

An open source project for integrating with SendGrid's Event Webhook.
Open Software License 3.0
53 stars 73 forks source link

Receive 403 Forbidden #21

Open raelb opened 8 years ago

raelb commented 8 years ago

Just installed to Heroku.

I have entered correct url in SendGrid settings (url includes username/password => works fine to log in to browser), However no events are logged when I click on "Test your integration".

Heroku log shows:

2016-06-22T00:19:49.857925+00:00 app[web.1]: Started POST "/" for 167.89.125.229 at 2016-06-22 00:19:49 +0000

2016-06-22T00:19:49.861072+00:00 app[web.1]: Processing by ReceiverController#handle_post as HTML

2016-06-22T00:19:49.861484+00:00 app[web.1]: Parameters: {"_json"=>[{"email"=>"example@test.com", ... removed... "url"=>"http://www.sendgrid.com/", "asm_group_id"=>10}]}}

2016-06-22T00:19:49.862537+00:00 app[web.1]: Filter chain halted as :header_check rendered or redirected

2016-06-22T00:19:49.862669+00:00 app[web.1]: Completed 403 Forbidden in 1ms (Views: 0.8ms | ActiveRecord: 0.0ms)

raelb commented 8 years ago

Mysteriously Event Kit is working ok now. Maybe there was something on the Heroku side that required some time for permissions to be activated..

ollie-new commented 7 years ago

Hi raelb,

I have just installed too, and have the same problem. Seems very odd that it just started working for you - can you tell me how long it took? And did you ever find out why?

Thanks!

ollie-new commented 7 years ago

To answer my own question, this has suddenly started working for me too. I have changed nothing, the only difference seems to be that we are now 24hrs later...

I should qualify, I still get a 403 when using the 'Test your integration' button, but 'real' emails sent via SendGrid are now having their events fired into my EventKit.

raelb commented 7 years ago

As I indicated in my previous comment: It looks like some part of the setup required some time to activate or propagate.

erikzrekz commented 6 years ago

Not sure if you guys noticed this but the only way you can get a 403 is from https://github.com/sendgrid/eventkit-rails/blob/master/app/controllers/receiver_controller.rb#L40.

I removed the condition if agent == "SendGrid Event API" or agent == "SendGrid Event API Test" as I was noticing a useragent of useragent"=>"Mozilla/4.0 (compatible; MSIE 6.1; Windows XP; .NET CLR 1.1.4322; .NET CLR 2.0.50727) when testing and since then I haven't had any issues.

Perhaps the original authors thought useragent from the Event Webhook would never change?