Skip to content
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

posthogjs 1.151.0 - Type error: Type 'PostHog' is missing the following properties from type 'PostHog': requestRouter, _send_retriable_request #1332

Open
williamlmao opened this issue Jul 31, 2024 · 2 comments

Comments

@williamlmao
Copy link

Just upgraded to 1.151.0 and started getting this error when building my next 14.2.5 app.

./app/PostHogProvider.tsx:15:27
Type error: Type 'PostHog' is missing the following properties from type 'PostHog': __captureHooks, __autocapture, elementsChainAsString, segmentIntegration, and 4 more.

  13 |
  14 | export function PHProvider({ children }: { children: React.ReactNode }) {
> 15 |   return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
     |                           ^
  16 | }
  17 |
  ▲ Next.js 14.2.5

Downgraded back to 1.103.1 and the error went away.

@benjackwhite
Copy link
Collaborator

Hey - any other details you can give? I just checked with our nextjs app (that is in this repo) and it all builds fine on the latest version.

Can you share a snippet of how posthog is imported / initialized?

@DavidMelnychuk
Copy link

Yep, our ./app/PostHogProvider.tsx looks like this:

'use client';
import posthog from 'posthog-js';
import { PostHogProvider } from 'posthog-js/react';

if (typeof window !== 'undefined') {
  posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY as string, {
    api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
    capture_pageview: false, // Disable automatic pageview capture, as we capture manually in <PosthHogPageView>
    autocapture: false,
  });
}

export function PHProvider({ children }: { children: React.ReactNode }) {
  return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants