Closed marcfrankel closed 11 months ago
Update
Using posthog.debug() reveals the problem is:
PostHog Debug error [PostHogFetchNetworkError: Network error while fetching PostHog] {
error: [AxiosError: There is no suitable adapter to dispatch the request since :
- adapter xhr is not supported by the environment
- adapter http is not available in the build] {
message: 'There is no suitable adapter to dispatch the request since :\n- adapter xhr is not supported by the environment\n- adapter http is not available in the build',
name: 'AxiosError',
code: 'ERR_NOT_SUPPORT'
},
name: 'PostHogFetchNetworkError'
}
So I believe these issues are linked: #127
Definitely a duplicate of #127—but I’m commenting to add that yes, shutdown
is going to be faster than await shutdownAsync
because it’s not awaiting that Promise. But that means your PostHog client won’t tear down properly. Please make sure you’re calling await shutdownAsync
once this gets fixed.
This should be fixed in the latest version as of https://github.com/PostHog/posthog-js-lite/pull/132
If not please feel free to re-open.
@benjackwhite assuming you forgot to close the issue, closing it!
Bug description
Not sure if this has to do with some issue on the ingestion level or something but recently we noticed that calling
await posthog.shutdownAsync()
was holding up the execution thread for around 9 seconds! Switching from shutdownAsync to just shutdown seemed to fix the issue.We're deploying in Next.js using vercel so under the hood these are either edge functions or AWS lambda functions. I think in this case it's an edge function.
How to reproduce
Related sub-librarie
Additional context
I think this issue might relate to edge functions on vercel. Additionally from digging into the source code, it seems like this is the only difference between the versions in posthog-node.ts:
So maybe it's an issue with feature flags?
Also more than possible this is a user issue and it's something I'm doing wrong. We recently moved to vercel and started noticing this slowing us down...