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))
})