简体   繁体   中英

How could I find out why Rails app throws error for a single, specific URL on Heroku while it works fine locally?

I have a Rails app running on Heroku that serves as the API for a front-end application.

I noticed that for a specific, dynamic URL, /bands/:band_id/members it consistently throws net::ERR_CONNECTION_CLOSED errors which breaks the app.

That specific URL doesn't throw an error when I run the Rails app locally and other URLs work fine on Heroku so I suspect this is a Heroku error but I'm not sure.

I couldn't get deeper in analyzing the problem as the request doesn't even appear in the Heroku logs.

Without more details I'm afraid I can only try to help you troubleshoot. Post as much code as you can. The route, the controller action, the view it's rendering, and any relevant logs from localhost and heroku would be a great start.

I've had Heroku requests timeout on my rails apps many times - in development there is often no time limit but if your request is taking too long that definitely could be the issue. How long does the request take on development? It could be as simple as shaving off a few seconds.

Otherwise I would say to check this out: Heroku websocket connection

Also be sure to clear everything you can on your browser, try other browsers, incognito mode, all of that. Try to isolate the problem to one area - even though Heroku is throwing the error it is almost certainly not causing the error.

Check your routes. Look at everything that is happening with that request in your dev and prod logs and try and find something different about this request. Compare it to others.

It is also a good idea to understand your logs and increase their verbosity - https://devcenter.heroku.com/articles/logging What levels of logging are available for Heroku?

Good luck!

Setup error monitoring on heorku. There are many addons listed under "Errors and Exceptions" category here - https://elements.heroku.com/addons

Eg. You can try Airbrake or Bugsnag . Most likely error is coming from you application. It's best practise to setup error monitoring but even before that you can check your server logs to debugs the issue - https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-logs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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