500 Internal Server Error occurs in Rails production environment

** Introduction ** I was messed up with a 500 Internal Server Error while creating a portfolio in Rails and would like to share with you how to solve the problem.

environment

Conclusion

Maybe due to the asset pipeline

Status

I've been developing in the development environment for a long time, and the application has been completed to some extent, so when I tried to deploy it in the production environment in the production environment, I got ** 500 Internal Server Error ** and could not solve it for 3 days. ..

What I did to solve the problem

--Changing the settings of the conf file of the web server (Nginx)
=> Not resolved --Around the socket such as deleting the puma socket
=> Not resolved --Review of other parts that may be related such as database.yml and Gemfile
=> Not resolved --Check the contents of production.log
=> Check for errors around the asset pipeline

The solution procedure I did

--First clean the asset pipeline with rake assets: clobber --bundle exec rake assets: precompile RAILS_ENV = production to precompile the asset pipeline
=> In my case, I was asked to install yarn, so install it. ――It started up well after restarting
=> In my case here was also done.

At the end

At first I decided it was a problem around the web server, but I should have looked at production.log from the beginning to see the error. It was a very educational error resolution.

Recommended Posts

500 Internal Server Error occurs in Rails production environment
[Rails] Reset the database in the production environment
rails tutorial About account activation in production environment
Rails5.1 + puma SSL connection in local production environment
[Rails] Solution when migration error occurs in acts-as-taggable-on
[Rails] About the error that the image is not displayed in the production environment
Migration error after Activerecord association in Rails5 + Docker environment (2)
I get Mysql2 :: Error :: ConnectionError in the production environment
[Error] The app is not displayed in the production environment
Error in rails db: migrate
Launch the Rails app locally in production mode (API Server)
exited with code 1 error resolution with docker-compose up in rails environment
Error in production environment (The asset "~" is not present in the asset pipeline.)
An error occurs when codedeploy-agent is installed in Ubuntu Server 20.04
Exit code 1 occurs when Rails is stopped in Docker environment
[Rails] Unexpected validation error in devise
Create a database in a production environment
[Rails 6] Customize Bootstrap in Rails + Bootstrap 5.0.0-alpha environment
[Rails] How to execute "rails db: create" etc. in production environment EC2
Can't output PDF in production environment (EC2, Amazon Linux) with Rails
[Rails] How to reset the database in production environment (Capistrano version)
How to reflect seeds.rb in production environment
Rails API server environment construction using docker-compose
Show Better Errors in Rails + Docker environment
Image is not displayed in production environment
Rails server cannot be started in Cloud9
Display the background image in the production environment
(Capistrano) After deploying, I get a We're sorry… error in the production environment.
Error in bundle install when running rails new
(Basic authentication) environment variables in rails and Docker
[Rails] Run LINEBot in local environment using ngrok
INTERNAL ERROR: cannot create temporary directory !: Docker environment
Rails <% = expression%> Why no error occurs when empty
[Rails] ActiveRecord :: HasManyThrough Order Error in Users # show
[Rails] How to use PostgreSQL in Vagrant environment
Group_by in Rails
How to deal with Selenium :: WebDriver :: Error :: UnknownError that occurs in Dokcer environment etc.
One case of solving a migration error in Rails
[Rails] Nginx, Puma environment deployment & server study [AWS EC2]
Sharing research on ER diagram automation in Rails environment
[Ruby on Rails Tutorial] Error in the test in Chapter 3
Regarding overcapacity when setting Rails tutorial environment in Cloud 9
Verification value error that occurred in a clustering environment
SSL in the local environment of Docker / Rails / puma
Beginners use ubuntu in windows to prepare rails environment
[Ruby on Rails] credential does not work in production environment even though I saved production.key
[Rails] What to do if you accidentally install bundle in the production environment in your local environment