UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'use' of undefined
See original GitHub issueDescribe the bug
Promise error
Occurs in next-i18next version
“next-i18next”: “^0.10.2”, “i18next-express-middleware”: “^1.7.1”, “i18next”: “^15.0.4”,
Steps to reproduce
i18n.js
const { localeSubpaths } = require('next/config').default().publicRuntimeConfig
const NextI18Next = require('next-i18next')
module.exports = new NextI18Next({
otherLanguages: ['th'],
localeSubpaths,
})
server.js
app.prepare().then(() => {
server.applyMiddleware(nextI18NextMiddleware(nextI18next))
server.get('*',(req, res) => {
handle(req, res, parsedUrl)
}).listen(port, (err) => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
})
Actual results
(node:33387) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'use' of undefined
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >TypeError: Cannot read property 'use' of undefined Express
You are missing to pass app as argument at Index.js import express from 'express'; const app = express() import {registerRoutes} from '.
Read more >UnhandledPromiseRejectionWar...
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'use' of undefined #210 · Describe the bug. Promise error · Occurs in next- ...
Read more >[Solved]-Cannot read property 'use' of undefined-node.js
You should first declare the app : var app = connect();. and then call the use method. app.use(doFirst); app.use(doSecond);.
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That doesn’t tell me anything, you’d need to post the full error. I’m quite sure you should post this type of question on StackOverflow. Thanks.
How do you expect me to help with this in any way, whatsoever? Please provide reproducible examples when opening issues, and pay attention to the issue templates - they’re there for a reason.