0

node app is working on localhost properly but not on heroku especially '/blog' route

node app is working on localhost properly but not on heroku especially '/blog' route error on heroku: 2022-08-19T17:15:19.022602+00:00 app[web.1]: /app/index.js:34 2022-08-19T17:15:19.022624+00:00 app[web.1]: const db1=client.db('blogData') 2022-08-19T17:15:19.022625+00:00 app[web.1]: ^ 2022-08-19T17:15:19.022626+00:00 app[web.1]: 2022-08-19T17:15:19.022626+00:00 app[web.1]: TypeError: Cannot read properties of undefined (reading 'db') 2022-08-19T17:15:19.022626+00:00 app[web.1]: at /app/index.js:34:26 2022-08-19T17:15:19.022627+00:00 app[web.1]: at Function.connect (/app/node_modules/mongodb/lib/mongo_client.js:231:24) 2022-08-19T17:15:19.022627+00:00 app[web.1]: at /app/index.js:32:17 2022-08-19T17:15:19.022629+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) 2022-08-19T17:15:19.022629+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:144:13) 2022-08-19T17:15:19.022630+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:114:3) 2022-08-19T17:15:19.022630+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) 2022-08-19T17:15:19.022630+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:15 2022-08-19T17:15:19.022631+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:346:12) 2022-08-19T17:15:19.022631+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:280:10) 2022-08-19T17:15:19.027159+00:00 app[web.1]: [nodemon] app crashed - waiting for file changes before starting... 2022-08-19T17:21:16.424321+00:00 heroku[web.1]: State changed from up to down 2022-08-19T17:21:16.427649+00:00 heroku[web.1]: State changed from down to starting 2022-08-19T17:21:18.716879+00:00 heroku[web.1]: Starting process with command `npm start` 2022-08-19T17:21:18.957020+00:00 heroku[web.1]: St

19th Aug 2022, 5:33 PM
born2code
born2code - avatar
4 ответов
0
<DD> bro can you check my code ...
19th Aug 2022, 5:43 PM
born2code
born2code - avatar
0
https://github.com/rankdeveloper/bloggy/blob/main/index.js <DD> my code 🥲 only blog route is not working on heroku...in my localhost it working properly
19th Aug 2022, 7:16 PM
born2code
born2code - avatar
0
<DD> okay np bro 👍
19th Aug 2022, 7:36 PM
born2code
born2code - avatar
0
Do you still facing the same error?
19th Nov 2022, 6:39 AM
ThelmaTollett