Closed dynalz closed 1 year ago
(cc: @pauldambra )
Copying random code off the internet finally back-fired 🤣 Thanks for the heads-up @neilkakkar and thanks for the report @dynalz . This is a super clear bug report thanks for taking the time 🙌
If I visit your page with adblockers on then I can run PostHog without seeing the error.
In your screenshot, the value of the first argument should be a number but appears to be a Date object. I think one of the other trackers on the page is over-riding Date.now()
which is very cheeky of them 🤣 Or maybe Chrome is being super helpful
My chrome (at least) provides a number as expected.
So I guess there are two things here
1) Is there a safer way for us to get the current time 2) Should we really throw in this method? If we send an event to PostHog without a UUID we generate one on the backend. So we lose re-triablity but you don't lose your data 🤔
My whole network at home blocks ad-trackers so this was hard to investigate 🤣
I hooked my phone up for remote debugging since that device has a VPN.
You have a date.js
from assets.clickfunnels.com
which overrides a number of Date operations. At least one in such a way that they no longer match the spec. That breaks PostHog but it'll potentially break other tools or your own code too.
The header of that file
/**
* Version: 1.0 Alpha-1
* Build Date: 13-Nov-2007
* Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
* License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
* Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
*/
This means I'd suggest that you strip that tool out and replace it tbh.
Funnily enough, the name clickfunnels rang a bell for me. We reported this exact problem to them in November 2021. Internal slack conversation for that investigation is here https://posthog.slack.com/archives/C0113360FFV/p1635850088131000 (@rcmarron originally found this bug for a different PostHog customer and might enjoy seeing it crop up again)
datejs that clickfunnels relies on has newer versions that don't have this problem but clickfunnels haven't updated for several years
I've emailed clickfunnels again to let them know this is still broken for people.
Hah! Funny to see this pop up again! Thanks for the mention @pauldambra!
I had stumbled on this article a bit ago. It talks about how to detect if a function has been monkey patched and also how to get the original function back (by pulling it from an i-frame 🤯). I haven't actually tried it, but could be worth looking into.
I'm having an issue on this page in particular (live): https://lp.ricardomatos.me/e2_imo4all_o2f1-masterclass_1
For some reason I cannot capture anything, as it just throws an error Error to reproduce in console:
posthog.capture('input-capture', { $set: {foo: "bar"} })
Traceback as follows:
I managed to debug and trace it back to here: