Promise error
"next-i18next": "^0.10.2",
"i18next-express-middleware": "^1.7.1",
"i18next": "^15.0.4",
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}`)
})
})
(node:33387) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'use' of undefined
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.
@isaachinman Before that's i use
await server.use(nextI18NextMiddleware(nextI18next))
that's not have promise error but my next js application not return server side rendering
So your server is undefined? Please post on StackOverflow.
馃憤
Here is more detail
next-i18next-middleware.js:21:10)
at app.prepare.then
at process._tickCallback
(node:33387) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:33387) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
i'm not sure that's error from express
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.
Most helpful comment
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.