Heroku Postgresql - Error Status 500 in second query

Asked

Viewed 76 times

0

I created a Node REST API that requests a Postgresql in Heroku. I use Postman to test the requests. It is working ok on the first request (Status: 200). Follow the Heroku log:

Primeira consulta GET

But when I try to do it a second time, it returns error (Status: 500 Internal Server Error). Follow the Heroku log:

Segunda consulta GET

One detail is that if I wait a while, I can perform a query again. But the second one keeps giving the same error. I used Nodemon to test the API on localhost. I put the same database environment variables on Heroku to see if the error occurred. It gave the same thing. The first status 200 and the second 500. But, maybe it can be a clue to the problem, when I stop and restart the server with npm start, I can do one more query.

I’ve searched the topics and the Internet here, and I can’t seem to figure it out. I don’t know if the problem is time-out from one connection to another, whether it’s with Postgres or Heroku’s free plan. I would really appreciate it if someone had a light to help me. Follow my code too:

Método GET

  • To restrict the source of the problem run your queries directly in Postgresql and check if there are any errors. If there is no error then the problem is not in Postgresql. Go eliminating each of the things you use until you identify where the problem occurs. Anyway I can say that Postgresql has no error 500.

  • Had already tested in Postgresql. Works normally for how many query I do. Thanks for the reply.

  • But in Postman it’s still the same problem.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.