Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set property 'toJSON' of undefined when using react-i18next example #5145

Closed
szczepanbarszczowski opened this issue Sep 12, 2018 · 3 comments
Labels
good first issue Easy to fix issues, good for newcomers

Comments

@szczepanbarszczowski
Copy link

szczepanbarszczowski commented Sep 12, 2018

Examples bug report

Example name

with-react-i18next

Describe the bug

I have problem when running dev server. I've got Cannot set property 'toJSON' of undefined on server. It looks like there is no i18n on request in file i18n.js. Translation doesn't work. On production build everything works well. I've tried most of solutions on Github regarding react-i18next example and always getting this crappy undefined error. Any help will be appreciated.

To Reproduce

Just clone this repository: https://github.com/szczepanbarszczowski/nextjs-starter

Expected behavior

It should work without an error.

Screenshots

zrzut ekranu 2018-09-12 o 13 51 03

System information

  • OS: Mac OS Mojave
  • Browser (if applies) Chrome 68
  • Version of Next.js: 6.1.2
@timneutkens timneutkens added help wanted good first issue Easy to fix issues, good for newcomers labels Sep 12, 2018
@szczepanbarszczowski
Copy link
Author

szczepanbarszczowski commented Sep 13, 2018

I've tried @next/cannary but still same error. Any thoughts why i18n is undefined on server?

@danielr18
Copy link
Contributor

It's because you are not using your custom server on dev, try setting your dev script to "dev": "node server.js".

@szczepanbarszczowski
Copy link
Author

@danielr18 You're right. Thank a lot man. It works well.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants