EOFError:API中的错误内容正文

时间:2016-07-16 12:39:10

标签: ruby-on-rails ruby heroku

还有一些关于类似错误的其他堆栈帖子,虽然我的跟踪强调了不同的方法失败,并且通常这些错误发生在多部分表单中,而我的不是。我几个星期以来一直在关注这个问题并决定是时候向别人寻求帮助。

场景:我有一个我安装的API挂载引擎。它是轻量级的,具有控制器和接收带有数据日志的发布请求的方法。这些日志的大小通常为60,000个字节,可通过request.body.read访问。确保它不是我的代码引发的错误。我删除了所有内容,它实际上是一个空方法,现在只返回200。像这样:

def tcpdata
  return 200
end

然而,我仍然得到错误。这让我感到非常沮丧,因为它似乎不在我手中。

我得到的错误是ERROR EOFError: bad content body,它在机架多部分方法get_current_head_and_filename_and_content_type_and_name_and_body

中失败了

以下是完整的跟踪:

2016-07-16T12:31:06.624089+00:00 heroku[router]: at=info method=POST path="/api/endpoint/devices" host=getbeambox.com request_id=992b3308-97db-4dbe-9ab0-343ee0a4f49f fwd="79.77.176.13,141.101.99.214" dyno=web.1 connect=1ms service=309ms status=500 bytes=507
2016-07-16T12:31:06.627426+00:00 app[web.1]: [2016-07-16 12:31:06] ERROR EOFError: bad content body
2016-07-16T12:31:06.627448+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart/parser.rb:148:in `get_current_head_and_filename_and_content_type_and_name_and_body'
2016-07-16T12:31:06.627450+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart/parser.rb:59:in `block in parse'
2016-07-16T12:31:06.627451+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart/parser.rb:56:in `loop'
2016-07-16T12:31:06.627452+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart/parser.rb:56:in `parse'
2016-07-16T12:31:06.627452+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart.rb:25:in `parse_multipart'
2016-07-16T12:31:06.627453+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/request.rb:375:in `parse_multipart'
2016-07-16T12:31:06.627454+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/request.rb:207:in `POST'
2016-07-16T12:31:06.627454+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:39:in `method_override_param'
2016-07-16T12:31:06.627455+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:27:in `method_override'
2016-07-16T12:31:06.627456+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:15:in `call'
2016-07-16T12:31:06.627457+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627458+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
2016-07-16T12:31:06.627459+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627459+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2016-07-16T12:31:06.627460+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627461+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/static.rb:116:in `call'
2016-07-16T12:31:06.627462+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627463+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
2016-07-16T12:31:06.627463+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627464+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:518:in `call'
2016-07-16T12:31:06.627465+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:165:in `call'
2016-07-16T12:31:06.627466+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627466+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
2016-07-16T12:31:06.627467+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
2016-07-16T12:31:06.627468+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
2016-07-16T12:31:06.627469+00:00 app[web.1]:    /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
2016-07-16T12:31:06.627469+00:00 app[web.1]:    /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
2016-07-16T12:31:06.627470+00:00 app[web.1]:    /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

1 个答案:

答案 0 :(得分:0)

对我来说,当我在BODY选项卡中选择了表单数据时,Postman正在创建问题。当我把它改成原始时,它对我有用。

我在多部分表单中看到过这个错误。