简体   繁体   English

Rails 3.0.10和Heroku的Paypal IPN 503错误

[英]Paypal IPN 503 error with Rails 3.0.10 and Heroku

I'm trying to integrate Paypal IPN notifications in a Rails 3.0.10 application which is deployed to Heroku (bamboo-mri-1.9.2). 我正在尝试将Paypal IPN通知集成到已部署到Heroku(bamboo-mri-1.9.2)的Rails 3.0.10应用程序中。 It's not the first time I integrate IPN on a Rails application, but I'm having a problem that is driving me mad and I'm clueless at this moment. 这不是我第一次将IPN集成到Rails应用程序中,但是我遇到了一个让我发疯的问题,此刻我一无所知。

I have defined a special route for IPN at config/routes.rb: 我在config / routes.rb中为IPN定义了一条特殊的路由:

match "/paypal_ipn" => "registrations#paypal_ipn", :as => :paypal_ipn

And I have the corresponding action in RegistrationController: 我在RegistrationController中有相应的操作:

class RegistrationsController < ApplicationController
  include ActiveMerchant::Billing::Integrations
  ...
  def paypal_ipn
    // Notification management stuff...
  end
end

The problem is that I'm unable to send an IPN notification to this URL once the application is deployed to Heroku, as the server always responds to the IPN simulator with a 503 Error. 问题是,一旦将应用程序部署到Heroku,我将无法向该URL发送IPN通知,因为服务器始终以503错误响应IPN模拟器。 The curious thing is that I can send any POST or GET requests to this URL successfully using CURL or any browser. 奇怪的是,我可以使用CURL或任何浏览器将任何POST或GET请求成功发送到此URL。

I've even replaced the paypal_ipn method's content by a raise "It exploded!" 我什至用raise "It exploded!"代替了paypal_ipn方法的内容raise "It exploded!" without any exception raised to the log, and skipped all the before filters I've seen around with same results. 不会在日志中引发任何异常,并跳过了所有我之前看到的具有相同结果的过滤器。

All I can see on heroku logs is this, but it doesn't helps me much... 我在heroku日志中只能看到的是这个,但对我没有太大帮助...

2012-05-20T17:32:47+00:00 heroku[router]: Error H13 (Connection closed without response) -
> POST reddeportiva-sta.heroku.com/paypal_ipn dyno=web.1 queue= wait= service= status=503 
bytes=2012-05-20T17:32:47+00:00 app[web.1]: !! Unexpected error while processing request: 
undefined method `include?' for nil:NilClass
2012-05-20T17:32:47+00:00 heroku[nginx]: 173.0.82.126 - - [20/May/2012:17:32:47 +0000] 
"POST /paypal_ipn HTTP/1.0" 503 607 "-" "-" reddeportiva-sta.heroku.com

Anybody knows if Paypal IPN notification messages have anything in particular which is different from a simple CURL POST request which could be causing this nightmare? 有人知道Paypal IPN通知消息是否特别有别于可能导致此噩梦的简单CURL POST请求?

EDIT Well, I've discovered the source of the problem, but I'm still investigating for a solution. 编辑嗯,我已经找到了问题的根源,但我仍在研究解决方案。

I'm using rack-iframe ( http://rubygems.org/gems/rack-iframe ) to let my users login and maintain sessions inside an iframe on their webpages. 我正在使用rack-iframe( http://rubygems.org/gems/rack-iframe )让我的用户登录并维护其网页上iframe中的会话。

It seems there is something on the Paypal IPN message that is making rack-iframe crash. 贝宝(Paypal)IPN消息上似乎有些东西正在使机架iframe崩溃。 I'll investigate it further and share my discoverings. 我将进一步调查并分享我的发现。

That was a really weird bug... 那真是个奇怪的错误...


EDIT 2 I've sent a pull request with a little fix for this issue to rack-iframe creator, so I think this problem is solved :-) https://github.com/merchii/rack-iframe/pull/1 编辑2我已经向rack-iframe创建者发送了具有此问题的一些修复的请求请求,所以我认为此问题已解决:-) https://github.com/merchii/rack-iframe/pull/1

The "undefined method `include?' “未定义的方法“包括?” for nil:NilClass" is curious, I would jack up the logging level to DEBUG and see what else is going on: for nil:NilClass“很好奇,我将日志记录级别提高到DEBUG,然后看看还有什么其他情况:

https://devcenter.heroku.com/articles/logging#logging_in_rails https://devcenter.heroku.com/articles/logging#logging_in_rails

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM