1

I'm running into a weird issue with my MERN app in Heroku. When I run my application locally it fetches all my requests under 1 second but on Heroku, I get h12/503 errors because it is taking 30 seconds which results in timeout errors. I understand the dev environment is different from production but I can't debug errors I can't reproduce. Do I have to upgrade my Heroku? because I don't really want to do that. Is there a way to fix this?

Here is an example of one of my routes with issues

const db = require('./config/keys').mongoURI;

mongoose.connect(process.env.MONGODB_URI || db, { useNewUrlParser: true, 
useUnifiedTopology: true })
    .then(() => console.log("MongoDB Connected"))
    .catch((err) => console.log(err))

const Storage = require('./models/Storage')
// route, GET, GET all items
server.get('/api/storage', (req, res) => {
    Storage.find()
        .then(items => {
            res.json(items)
        })
        .catch(err => console.log(err))
})
Andrew Est
  • 31
  • 1
  • 1
  • 3
  • can the heroku admns help you pin down the exact connection or service that times out? – Nikos M. Apr 13 '20 at 16:30
  • it might just be a configuration issue if the route does not work at all (eg wrong URI), but if it does it sometimes only it might be a settings/infrastructure issue – Nikos M. Apr 13 '20 at 16:31
  • That's the thing I can't contact them unless I pay for their service. Like I said it works locally it's just not working on Heroku – Andrew Est Apr 13 '20 at 16:37

0 Answers0