Simon de Bakker
Simon de Bakker

Reputation: 71

Next.js build version fails with 'Cannot read property 'auth' of undefined'

For the past few months we've been working on a website based on Next.js with great joy. It all worked splendidly and had no big problems. However as of yesterday we're suddenly getting an error on the production version when applying a router.push: Cannot read property 'url' of undefined. The router.push in question is as follows:

router.push(
{
   pathname: `/catalogus/category=${filters.category[soortSelected].slug}`,
},
undefined,
{ scroll: false }
);

The function where it goes wrong is called formatUrl, but I have no real clue as to it's purpose (apart from the obvious function name of course). It get's a urlObj as parameter, but where that comes from, I have no clue either. The strange thing is, even reversing to an old commit does not seem to help, which is just baffeling to me.

EDIT: Apparently it has something to do with the locale, as it only breaks on the 'defaultLocale' version and not any other language.

Upvotes: 2

Views: 3016

Answers (1)

Simon de Bakker
Simon de Bakker

Reputation: 71

Found the problem. Apparently I gave an undefined to a Link href, but only sometimes. So a simple check to see if the given value exists was enough in the end.

Upvotes: 5

Related Questions