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:
But when I try to do it a second time, it returns error (Status: 500 Internal Server Error). Follow the Heroku log:
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:
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.
– anonimo
Had already tested in Postgresql. Works normally for how many query I do. Thanks for the reply.
– Clovis Daniel Costa
But in Postman it’s still the same problem.
– Clovis Daniel Costa