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 read properties of null (reading 'Error') #226

Closed
1 task
vasilyeu-pavel opened this issue Jul 22, 2022 · 3 comments · Fixed by #586
Closed
1 task

Cannot read properties of null (reading 'Error') #226

vasilyeu-pavel opened this issue Jul 22, 2022 · 3 comments · Fixed by #586
Labels
help wanted Extra attention is needed needs reproduction Needs more information and a way to reproduce the issue

Comments

@vasilyeu-pavel
Copy link

vasilyeu-pavel commented Jul 22, 2022

  • I am interested in helping provide a fix!

Describe the bug
We have received some errors:

(debug) e.top is null
Cannot read properties of null (reading 'Error')

This error was happing in this line in the file (~partytown/debug/partytown-sandbox-sw.js):
const serializedValueIsError = value => value instanceof window.top.Error;

Iframe and main application have the same domains and we didn't have errors with cross domain communication. Because of partytown is changing the main window history object, our application was broken and we couldn't navigation by page.
Can you help, please, we don't understand how it is possible window.top = null

Expected behavior
Application navigation must work, if iframe has error

Partytown version
0.6.2

Additional context

devices:
Samsung SM-A525F (Chrome Mobile 103.0.0)
Samsung Internet 17.0 (Samsung SM-J415FN)
Huawei STF-L09 (Chrome Mobile 103.0.0)

@adamdbradley adamdbradley added help wanted Extra attention is needed needs reproduction Needs more information and a way to reproduce the issue labels Aug 8, 2022
@IcyDefiance
Copy link

IcyDefiance commented Nov 17, 2022

I also ran into this error, and figured out that it happens after the partytown iframe is removed from the page.

With most frontend frameworks, the easiest way to prevent this is to mount the framework to a div inside the body tag, instead of the body tag itself.

I'm using Hotwire's Turbo library, which makes the workaround a little harder, but I was still able to do it by wrapping the main content with <turbo-frame id="main-frame" turbo-action="advance" data-turbo-progress-bar="true">, putting a <turbo-stream> tag inside that to update the title and meta tags after navigation, and using this snippet to show the progress bar that normally only appears for root-level navigation.

@jpbalarini
Copy link

jpbalarini commented Mar 16, 2023

@IcyDefiance, do you have any recommendation for fixing this issue but with a project that uses turbo links?

@imattferreira
Copy link

Hey, what's up?

Anyone had this same issue with NextJS? This issue is appearing a lot in a NextJS 12 project that I develop and I already tested implementing Partytown via experimental integration of NextJS and following the manual implementation present in the Partytown's documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed needs reproduction Needs more information and a way to reproduce the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants