Rails application deployed on Elastic Beanstalk with Puma fails - 502 errors on every request Rails application deployed on Elastic Beanstalk with Puma fails - 502 errors on every request nginx nginx

Rails application deployed on Elastic Beanstalk with Puma fails - 502 errors on every request


I faced the same error and adding these two lines to config/puma.rb fixed the problem:

bind "unix:///var/run/puma/my_app.sock"pidfile "/var/run/puma/my_app.sock"

After this step I faced another error to add ENV values, which is very straight forward.

Hope this helps.


Sorry - Super late to the game. But I found this entry when searching for the same error message and could solve it differently.

I am trying to let a Rails 6.1.1 (currently latest and greatest) application run on AWS Beanstalk (Puma with Ruby 2.6), where I got the same error as described in this post: Nginx throwing above connection error / Puma seems not reactive (no entries in puma logs) / When SSHing into the machine it shows Puma is running (initctl status puma -> shows process ID).

After some days of research (and trying all above answers without success) - I switched to Passenger - but still same result. Researching the same problem for Passenger showed the proper solution:

Do not use the gem of the application server in production when you want to use the already provided application server of the AWS platform branch ("Puma with Ruby 2.6..." or "Passenger with Ruby 2.6...") (it somehow collides with the already installed version). Therefore in your Gemfile:

gem 'puma', '~> 5.0', groups: [:development, :test]

respectively:

gem "passenger", ">= 5.3.2", require: "phusion_passenger/rack_handler", groups: [:development, :test]

or use the AWS Beanstalk platform without already installed application server ("Ruby 2.6 running on...)

PS: Seems to be only a solution for higher Rails versions (my old Rails 5.1 app runs perfectly on the "Puma with Ruby 2.6" platform even with the gem "normally" installed.


Changing config.force_ssl = true to false fixed the issue for me.