posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

Next.js wrapper giving me completely cryptic errors despite having sourcemap uploads

Open jakeleventhal opened this issue 1 month ago • 4 comments

Bug description

Image Image

I am getting hundreds of "minified react errors" despite having sourcemaps uploaded. There is no stack trace for any of these errors.

It seems almost none of my errors have stack traces even I am certain they're being uploaded:

Image

How to reproduce

My next.config.ts:

import { withPostHogConfig } from "@posthog/nextjs-config";

export default withPostHogConfig(
	{ ... },
	{
		envId: process.env["POSTHOG_ENV_ID"]!,
		host: process.env["NEXT_PUBLIC_POSTHOG_HOST"],
		personalApiKey: process.env["POSTHOG_API_KEY"]!,
		sourcemaps: {
			enabled: !!process.env["NEXT_PUBLIC_SERVER"],
			project: "Redacted"
		},
	},
);

Related sub-libraries

  • [ ] All of them
  • [x] posthog-js (web)
  • [ ] posthog-js-lite (web lite)
  • [ ] posthog-node
  • [ ] posthog-react-native
  • [ ] @posthog/react
  • [ ] @posthog/ai
  • [x] @posthog/nextjs-config

Additional context

Thank you for your bug report – we love squashing them!

jakeleventhal avatar Oct 31 '25 12:10 jakeleventhal

I'm having trouble getting sourcemaps to generate and upload - can I ask where you're getting the envId value from in posthog?

Chippd avatar Oct 31 '25 13:10 Chippd

Another example

Image

jakeleventhal avatar Oct 31 '25 16:10 jakeleventhal

@PostHog/team-error-tracking

marandaneto avatar Nov 01 '25 07:11 marandaneto

I've added some warning banners that explain the first two issues (minified react and non-error promises) in https://github.com/PostHog/posthog/pull/41424

daibhin avatar Nov 20 '25 13:11 daibhin