-
Notifications
You must be signed in to change notification settings - Fork 129
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
web-vitals extension loads script from incorrect URL #1346
Comments
+1 I am also receiving this error for web vitals. I have a NextJS app with rewrites as a reverse proxy. |
The simplest solution as of now is to add the path in your list of rewrites next.config.js
|
great write up @Jacksondr5 thank you! Super clear really we should make |
I just updated to newest version and still have this issue, has it been resolved? or do I need to use @junioryono workaround? Thank you |
Hello, I'm encountering an issue where PostHog is attempting to load the web-vitals script, but is using an incorrect URL:
/ingest/ingest/static/web-vitals.js?v=1.154.2
. This does proxy through to posthog.com (I see some ASCII art of a hedgehog), but returns a 404.I'm running a NextJS app with rewrites as a reverse proxy. Specifically, these:
next.config.js
My calls to the
/ingest/decide
and/ingest/e
endpoints are working properly.Looking through the code, I think the issue may be this call to endpointFor. When I run through the code in the Chrome debugger, I can see that endpointFor gets called and prepends the extra /ingest that's causing the issue:
Happy to contribute a PR to a solution. Not entirely sure what that solution should be.
My thoughts are to replace
posthog-js/src/extensions/web-vitals/index.ts
Lines 73 to 75 in f5a0d12
with
This would mean that endpointFor only gets called once, by loadScript.
There are other extensions that do this, instead of also calling endpointFor themselves (tracing-headers, toolbar, surveys). However, autocapture does make the same kind of call that web-vitals does, so I'm not sure if this is correct.
The text was updated successfully, but these errors were encountered: