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

null is not an object (evaluating 'window.localStorage.getItem') #80

Open
ThulinaWickramasinghe opened this issue Dec 25, 2024 · 7 comments

Comments

@ThulinaWickramasinghe
Copy link

I'm using your package with Next.js 14 pages router. We're using next ex
I'm using latest version of your package for pages router.
Since some time I've been getting some errors on sentry.

null is not an object (evaluating 'window.localStorage.getItem')

Screenshot 2024-12-25 at 22 12 04

I would love to have your support in fixing this issue.

@ThulinaWickramasinghe
Copy link
Author

ThulinaWickramasinghe commented Dec 25, 2024

Since I'm using next export with no SSR I suspect this issue might be caused by private browsing not allowing to access localStorage. And also I'm using v2 of your package since the project uses pages router. I would like to contribute in fixing this issue if you're accepting PRs.

@ThulinaWickramasinghe
Copy link
Author

I'm getting several other sentry errors from this code which I suspect to be related to this issue.

Screenshot 2024-12-25 at 22 21 49

@ThulinaWickramasinghe
Copy link
Author

@martinkr

@martinkr
Copy link
Owner

Hi @ThulinaWickramasinghe,

Thank you for reporting your issue. Unfortunately, browser behaviour regarding local storage and private browsing is far from standardised. I can offer you two solutions. First, could you consider using the query string instead of the local storage by setting languageDataStore:'query' (or omitting it altogether)? Or, as an alternative, would you consider using a cookie instead?

Have a great day,

Martin

@ThulinaWickramasinghe
Copy link
Author

Hello @martinkr!

Thanks for the quick response!

Currently I've omitted this languageDataStore field. Let me try with query instead.

@martinkr
Copy link
Owner

martinkr commented Jan 6, 2025

Hi @ThulinaWickramasinghe,

Can we close the issue?

@ThulinaWickramasinghe
Copy link
Author

Hi @martinkr!

We didn't test the task yet, so I can't yet confirm whether this issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants