-
Notifications
You must be signed in to change notification settings - Fork 134
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
fix: empty query param when calling external dependency toolbar.js #1456
fix: empty query param when calling external dependency toolbar.js #1456
Conversation
@lucasra1 is attempting to deploy a commit to the PostHog Team on Vercel. A member of the Team first needs to authorize it. |
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
Please keep open and review. Thanks |
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
Please keep open and review. Thanks |
@@ -49,7 +49,7 @@ assignableWindow.__PosthogExtensions__.loadExternalDependency = ( | |||
// this ensures that we bust the cache periodically | |||
const timestampToNearestFiveMinutes = Math.floor(Date.now() / fiveMinutesInMillis) * fiveMinutesInMillis | |||
|
|||
scriptUrlToLoad = `${scriptUrlToLoad}?&=${timestampToNearestFiveMinutes}` | |||
scriptUrlToLoad = `${scriptUrlToLoad}&t=${timestampToNearestFiveMinutes}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we totally missed this PR sorry...
fixes #1458 |
@pauldambra I think the github workflow needs to be approved. https://github.com/PostHog/posthog-js/actions/runs/11551538865 |
ugh... that should really work once merged 🤔 |
Changes
Changed the URL to use
t=<num>
as query param instead of empty/undefined param name (v=161.1&=<num>
).Checklist
Backstory
We use posthog in a nextjs application and use nextjs's rewrites as a proxy for better tracking. We noticed that the toolbar does not work on our site. when checking the logs we noticed that the rewrites did not work for the toolbar:
But the
web-vitals.js
loaded without a problem...Further investigation lead to the empty query param for the
toolbar.js
rotating token to bust the cdn cache.?v=1.166.1?&=1728316200000
The current stable version of next.js (
14.2.14
) has a "bug" that can't handle empty query params correctly in rewrites. The most recent canary version of nextjs seems to not have this bug anymore.But still I think its better when posthog does not use an empty query param as this seems like something that was not intentional in the first place and secondly can result in unexpected behavior in frameworks like nextjs