question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Infinite 307 redirects on automatic locale detection when upgrading to anything greater than serverless-component@1.19.0

See original GitHub issue

Hey, there seems to be a bug with the latest serverless component with automatic locale detection.

Nextjs version: 10.2.2. Machine: Mac OSX

This is my nextjs configuration:

{
        target: 'serverless',
        devIndicators: {
            autoPrerender: false,
        },
        i18n: {
            locales: ['en', 'es'],
            defaultLocale: 'en',
        },
    }

Here are my steps:

I updated to the latest alpha version of serverless component. When my Language is ‘es’ (configured in google chrome settings) and I land on mywebsite.com/ I get redirected to mywebsite.com/es and then I notice an infinite 307 redirects to /es after this.

After downgrading to serverless-component@1.19.0 the issue stops happening.

Has anyone encountered this issue too?

Just a note, I have configured my cloudfront to not pass any cookies. (most likely not the cause)

        cloudfront:
            distributionId: XXXXXX
            defaults:
                forward:
                    cookies: 'none'

Let me know if there is any other information I can provide

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
dphangcommented, May 25, 2021

Yes, I think I forgot to check to redirect only when on the root URI, I will fix it and add some tests for it

2reactions
jvarhocommented, May 23, 2021

@jvarho I think you refactored this recently, wondering if you know where the bug might be?

Yeah, I can guess. I’ll see if I can fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC: I18n Routing · Discussion #17078 · vercel/next.js - GitHub
js itself! I just have one question: the automatic language detection will only run on the / route and automatically redirect to the...
Read more >
Advanced Features: Internationalized Routing - Next.js
js will no longer automatically redirect based on the user's preferred locale and will only provide locale information detected from either the locale...
Read more >
defaultLocale is not keeping default lang in Next.js i18n
js will no longer automatically redirect based on the user's preferred locale and will only provide locale information detected from either the ...
Read more >
Advanced internationalization with Next.js and middleware
We turn off Next.js locale detection because we are going to handle that ourselves in the middleware. /** @type {import('next').NextConfig} ...
Read more >
Automatic User Language Detection in TranslatePress
The Automatic User Language Detection add-on uses only soft redirects, which happen on the client side. But there's a problem: finding out the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found