connection problems within ruby on rails and postgresql when /post requests are made

187 views Asked by At

I am currently trying to push in production my small app, which consist of a ruby on rails back end and a react front end. I wanted to try cookie based authentication for my log in process.

When I tried the application in development mode, everything was fine. Then I try to push it on jelastic cloud to see if it was still working on the cloud but everytime I tried to create a new user or to log in with an existing user, the server returns me a 500 error.

Here are my backend configuration:

A nginx load balancing NGINX 1.22.1 node.
A NGINX 1.22.0 ruby 3.1.2 app server node
And a PostgreSQL 15.2 database node.

The first thing I did was to search into the nginx error logs the possible cause of the issue, and I found theses lines:

the log of my errors

So I thought I did not configure my postgresql database properly, but I was able to run command like : "rails db:create and rails db:migrate"

I tried to open a rails console into my rails server and to search manually for a user, and everythings was working fine.

I do not think it is a cors issues cause I am checking if the user is logged in, and this api call ( a get method) is working perfectly well. However, this function does not need the database.

I do not think either that it may be a error into my code cause everything was working well in development mode. I just do not understand why, when I use Active record from the console it is working but not when the program call it from a controller.

May it be a problem in the nginx config?

I am pretty sure that it must a stupid mistake, but after many weeks looking for it, I still have not found it.

Thank you very much.

0

There are 0 answers