next.js icon indicating copy to clipboard operation
next.js copied to clipboard

ReferenceError: __NEXT_DATA__ is not defined

Open pnemi opened this issue 8 years ago • 4 comments

Bug report

Describe the bug

I don't know what this error is. Happens on app start and on every reload. Should I define that var somewhere or am I missing something? I didn't find anything about it on your site.

System information

  • OS: all
  • Browser (if applies): all
  • Version of Next.js: 4.2.1

pnemi avatar Oct 23 '18 11:10 pnemi

Definitely should be defined already as it's part of the scripts, I'm going to close this as there's no reproduction, maybe upgrade as you're a few versions behind.

timneutkens avatar Oct 23 '18 12:10 timneutkens

But can you please point me somewhere where I can read what it is and what am I missing to declare?

pnemi avatar Oct 25 '18 09:10 pnemi

It's defined as part of the Next.js codebase, you don't have to define it, but I'd be happy to look at a reproduction of the issue 👍

timneutkens avatar Oct 25 '18 20:10 timneutkens

I've got some router passed to props in my index.js page file to redirect from index page to another which probable caused Next not properly define that variable. I ended up using next/router and using this method https://github.com/zeit/next.js/wiki/Redirecting-in-%60getInitialProps%60 and it's no longer throwing that exception!

pnemi avatar Oct 26 '18 05:10 pnemi