partytown icon indicating copy to clipboard operation
partytown copied to clipboard

Error finding instance and failed analytics report bug

Open Avisaac opened this issue 2 years ago • 13 comments

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"

Avisaac avatar Jun 22 '22 15:06 Avisaac

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

mhevery avatar Jun 29 '22 22:06 mhevery

Related: https://github.com/BuilderIO/partytown/issues/72, having the same issue btw

royduin avatar Aug 24 '22 13:08 royduin

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

Avisaac avatar Aug 28 '22 14:08 Avisaac

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.

mhevery avatar Aug 28 '22 19:08 mhevery

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

royduin avatar Aug 30 '22 07:08 royduin

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://github.com/SujayPrabhu96/integrate-gatsby-google-tagmanager-using-partytown

Env needs to be set is: GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID

SujayPrabhu96 avatar Jan 31 '23 06:01 SujayPrabhu96

@mhevery Is there any update on this issue ?

SujayPrabhu96 avatar Feb 14 '23 08:02 SujayPrabhu96

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

szafran89 avatar Feb 22 '23 12:02 szafran89

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.

TheDutchCoder avatar Sep 14 '23 12:09 TheDutchCoder

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

mhevery avatar Sep 14 '23 16:09 mhevery

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.

sthobis avatar Oct 30 '23 18:10 sthobis

Can I ask for a PR with tests showing the failure to simplify our reproduction of the issue. https://github.com/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!

techfg avatar Nov 05 '23 02:11 techfg

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)

bsivaganeshan-eb avatar Nov 23 '23 12:11 bsivaganeshan-eb

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

jjpaulino avatar Feb 25 '24 19:02 jjpaulino

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

MichelAraujo avatar Mar 04 '24 22:03 MichelAraujo

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

vladetsky avatar Mar 22 '24 12:03 vladetsky

@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?

techfg avatar Mar 22 '24 20:03 techfg