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

Error finding instance and failed analytics report bug #202

Closed
Avisaac opened this issue Jun 22, 2022 · 17 comments · Fixed by #573
Closed

Error finding instance and failed analytics report bug #202

Avisaac opened this issue Jun 22, 2022 · 17 comments · Fixed by #573
Labels
needs reproduction Needs more information and a way to reproduce the issue

Comments

@Avisaac
Copy link

Avisaac commented Jun 22, 2022

We have an app that is server side rendered (Node express and Handlebars) and has Google tag manager and Google analytics reports in it.
We are trying to add partytown to improve our Lighthouse score and performance.
We have a reverse proxy via Nginx.

We are having two problems right now

  1. Sometimes the Partytown errors out with something unknown I don't understand why and when this happens but when it does it means the whole service worker does not really work at all. I think maybe this is some race condition because I sometimes get it sometimes I don't?
    Screenshot
    image

  2. when partytown does load but the collect is a bit weird
    We have one that is failing and the other two are marked as not completed and also one of them has all the dataLayer variables as undefined
    Screenshots
    image
    image

Version
"builder.io/partytown": "^0.6.0"

@mhevery
Copy link
Contributor

mhevery commented Jun 29, 2022

We need a way to reproduce the issue otherwise there is not much we can do. Please provide a simple reproduction.

@mhevery mhevery added the needs reproduction Needs more information and a way to reproduce the issue label Jun 29, 2022
@royduin
Copy link

royduin commented Aug 24, 2022

Related: #72, having the same issue btw

@Avisaac
Copy link
Author

Avisaac commented Aug 28, 2022

Thanks @royduin I will look at that issue and see if any insight on a solution pops up
@mhevery , we have put that task of integrating partytwon aside for a few sprints and now are back to it, sorry for not being responsive on that.
Im not sure what else data you need for reproducing, I am not sure what the cause for this error is so I was not able to actually setup any working reproduction of this error, if there any missing data on the stack/setup that we have that can help is missing please let me know and I will supply

@mhevery
Copy link
Contributor

mhevery commented Aug 28, 2022

As much as we would like to help, we need reproduction steps to dig into what is going on, screenshots are not enough. Without seeing the error on our machines, there is not much we can do.

@royduin
Copy link

royduin commented Aug 30, 2022

As for #72; just install GTM and try to debug with https://tagassistant.google.com

@SujayPrabhu96
Copy link

Hi folks, even I am facing the same issue in preview mode.
Error message is Error finding instance "1wxccpy1m7t.d" on window 2

Here is the site for reproducing the issue: https:/SujayPrabhu96/integrate-gatsby-google-tagmanager-using-partytown

Env needs to be set is:
GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID

@SujayPrabhu96
Copy link

@mhevery Is there any update on this issue ?

@szafran89
Copy link

I have the same issue with Nuxt3. Is there any solution?

@TheDutchCoder
Copy link

TheDutchCoder commented Sep 14, 2023

For us this happens when switching between tabs (some of our internal links open a new tab), I wonder if the Service Worker doesn't correctly deal with multiple tabs and tracking which window belongs where?

I think the instance ID is wrongfully created with 1 again, instead of 2, yet the worker expects the right one:
image

If I'm not mistaken, that should say "Created top window 2 environment", because this is the 2nd window the worker is running in.

@mhevery
Copy link
Contributor

mhevery commented Sep 14, 2023

Can I ask for a PR with tests showing the failure to simplify our reproduction of the issue. https:/BuilderIO/partytown/blob/main/tests/integrations/gtm/index.html

@sthobis
Copy link

sthobis commented Oct 30, 2023

I ran into this error when I'm trying to run Tag Assistant. I can kind of reproduce this error (looks similar) by running current test suite and adding some gtm_debug query param, not sure if that's enough information.

http://localhost:4000/tests/integrations/gtm/?gtm_debug=1698689697661
image

I want to debug this but honestly I don't know where to start.

@techfg
Copy link
Contributor

techfg commented Nov 5, 2023

Can I ask for a PR with tests showing the failure to simplify our reproduction of the issue. https:/BuilderIO/partytown/blob/main/tests/integrations/gtm/index.html

I believe there might be multiple issues going on here.

The GTM Preview issues are well described by @slawekkolodziej in #72 along with his solution and contribution - thank you @slawekkolodziej!

Underlying though, the $instanceId$ not found errors (Error finding instance "2dab62yogpr.d" on window 2 in debug build) appear to be an issue when multiple tabs/pages are open and service workers are involved (problems do not seem to occur when atomics are used). I created #492 since I'm easily able to reproduce the issue without GTM.

@mhevery - #493 contains a PR with tests and #492 describes how to manually reproduce as well - thank you!

@bsivaganeshan-eb
Copy link

Hi @sthobis, Have you resolved the issue? I am also facing the same issue

data-pterror="Error: 25p416vnd9f.d not found
at $e (blob:https://{host}/7aed8ded-2e59-4659-8c85-59aefdd3be9c:2:5065)

@jjpaulino
Copy link

I'm also facing this issue when switching tabs. Is there any update or has anyone found a workaround?

@MichelAraujo
Copy link

I'm also facing this issue when switching tabs. @jjpaulino found something?

@vladetsky
Copy link
Contributor

@MichelAraujo @jjpaulino @mhevery I've added the fix here

@techfg
Copy link
Contributor

techfg commented Mar 22, 2024

@vladetsky -

This is great, thank you! I had created #492 which is a simplified version of the multiple tabs issue given this issue (#202) is related to GTM and the core issue has nothing to do with GTM (as evidenced by your fixes in #573). I can't recall exactly why I added more tests beyond just platform\multiple-pages but I'm sure there was a reason. Possibly we should merge the tests in #493 in to your #573 to provide broader coverage for this issue, especially around integrations?

@gioboa gioboa linked a pull request Mar 24, 2024 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.