Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Issue with dependency #85

@phkundi

Description

@phkundi

Hi there. I recently posted about an issue I had on Stackoverflow and was advised to share it here as well. I am not 100% confident that Posthog was the source of the problem I had, but after updating my dependencies and removing Posthog, I was able to resolve my issue. As I'm not interested in reintroducing the error, I haven't verified that this issue is coming from Posthog but I figured it might be helpful to post this anyways.

Here's the info from my SO post:

I have a critial issue on my NextJS app where all of the requests to my API routes time out in production. It used to work perfectly up until recently but now my app is unusable (except for the static landing page). It's working perfectly in my local environment.

I'm using NextJS 14.0.1 with App Router; MongoDB + Mongoose

Here are the timed logs from a simple /api/lead endpoint (create a lead in DB)

  • MongoDB Connection: 880.541ms
  • Request JSON Parsing: 0.913ms
  • Finding Lead: 556.57ms
  • Sending Response: 1.31ms

When fetching this through postman, it still takes > 10 seconds for me to receive the response. Default timeout on Netlify / Vercel happens after 10 seconds.

Eventually, my console showed some useful information with the following error:

Compiling /api/auth/[...nextauth] ...
 ⚠ ./node_modules/.pnpm/debug@4.3.4_supports-color@9.4.0/node_modules/debug/src/node.js
Module not found: ESM packages (supports-color) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

Import trace for requested module:
./node_modules/.pnpm/debug@4.3.4_supports-color@9.4.0/node_modules/debug/src/node.js
./node_modules/.pnpm/debug@4.3.4_supports-color@9.4.0/node_modules/debug/src/index.js
./node_modules/.pnpm/follow-redirects@1.15.6_debug@4.3.4/node_modules/follow-redirects/debug.js
./node_modules/.pnpm/follow-redirects@1.15.6_debug@4.3.4/node_modules/follow-redirects/index.js
./node_modules/.pnpm/axios@1.6.8/node_modules/axios/dist/node/axios.cjs
./node_modules/.pnpm/posthog-node@4.0.0/node_modules/posthog-node/lib/index.esm.js
./libs/posthog.js
./libs/next-auth.js
./app/api/auth/[...nextauth]/route.js

Like I said, I upgraded all of my dependencies and removed Posthog, and requests came through normally again. Not sure why this issue was only present in my production environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions