no possibility found to get query

Viewed 25

We have a Nextjs application that uses "next-i18next" package on the server side with getServerSideProps(). The app was working fine. But recently the server started crashing on the page that uses "next-i18next". The error:

no possibility found to get query

Here is the configurations:

const { nextI18NextRewrites } = require('next-i18next/rewrites')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
    enabled: process.env.ANALYZE === 'true',
})
const withImages = require('next-images')

const localeSubpaths = {
    uzc: 'uzc',
    kaa: 'kaa',
    ru: 'ru',
    // uz: 'uz',
}
module.exports = withBundleAnalyzer(
    withImages({
        env: {
            BASE_URL:
                process.env.NEXT_PUBLIC_BASE_URL ||
                'https://yyyyy/v1',
        },
        publicRuntimeConfig: {
            localeSubpaths,
        },
        rewrites: async () => nextI18NextRewrites(localeSubpaths),
        webpack(config) {
            config.module.rules.push({
                test: /\.svg$/,
                use: ['@svgr/webpack'],
            })
            return config
        },
    }),
)

How we use it:

export const getServerSideProps = async (ctx) => {
  const { query, req } = ctx
   if (query.code) {
    return {
        redirect: {
              destination: '/',
              permanent: true,
            },
        }
    }

    return {
        props: {
          namespacesRequired: ['common', 'header', 'footer']
        },
    }
}
0 Answers
Related