Cursor Editor → Next.js Dev Environment

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

I’m working on a Next.js 16 (Turbopack) project inside Cursor, and I consistently get 500 errors when accessing this route:

GET /api/leads/[leadId]/links
POST /api/leads/[leadId]/links

The UI always displays “Request failed”, and DevTools shows:

GET …/links → 500 (Internal Server Error)

POST …/links → 500 (Internal Server Error)

Sometimes preview shows only 1 or an empty body

Chrome reports: “Failed to load response data”

The API handlers and internal service functions are implemented correctly, but something in Cursor’s dev environment causes:

InMemoryLeadStore to reset between requests OR

params.leadId to become invalid OR

The API to return 500 before reaching my logic.

Additionally, the Cursor Dev Server terminal sometimes shows:

Error: Lead not found
Route “/api/leads/[leadId]/links” used ‘params’ as a Promise…

Even though the route file is using the correct Next.js 16 signature.

This only happens inside Cursor, not in a standard local Next.js environment.

Steps to Reproduce

Steps to Reproduce:

Open the project in Cursor

Run npm install and then npm run dev

Create a lead (works fine)

Open the lead → go to “Links” tab

Observe “Request failed” immediately

Try clicking “Add Link → Save Link”

Request still fails with 500

In Network tab:

GET /api/leads//links → 500

POST /api/leads//links → 500

Response Preview sometimes empty or just “1”

In terminal: error thrown before handler runs (“Lead not found”)

This issue only occurs in Cursor’s environment, not in normal local development.

Expected Behavior

Expected Behavior:

The route /api/leads/[leadId]/links should return the list of stored link attachments for a lead.

Adding a link should call the POST handler and save the data in the in-memory store.

The Links tab should load successfully and not show “Request failed”.

DevTools should show a valid JSON response instead of a 500 error.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: (copied from About Cursor)
VSCode Version: (copied from About Cursor)
Commit: (copied from About Cursor)

For AI issues: which model did you use?

Model used: GPT-5.1, GPT-4.1, Sonnet 3.5 (depending on the task)
Issue appears regardless of model selection.

For AI issues: add Request ID with privacy disabled

Request ID: (unable to retrieve — issue occurs outside AI messaging)
This is not an AI model hallucination issue — the problem happens in the integrated Next.js dev environment inside Cursor.

Additional Information

This bug blocks all API routes under /api/leads/[leadId]/links from functioning inside Cursor’s dev environment.

Even after ensuring correct Next.js 16 route handlers and fully resetting the project:

  • GET /api/leads//links returns 500
  • POST /api/leads//links returns 500
  • Preview pane shows “Failed to load response data”
  • Terminal intermittently prints “Lead not found” even when it exists
  • Cursor shows “params must be unwrapped from a Promise” even when using correct Next.js 16 signature

This only happens when running the project inside Cursor.
Running the same project in a normal terminal outside Cursor works correctly.

I suspect Cursor Dev Server or TurboPack integration is corrupting dynamic route params or caching an invalid version of the in-memory store.

This breaks the entire “Links” feature of the CRM and prevents further development.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. Let’s quickly isolate the cause.

Please check the following steps and send the results/logs:

  1. Run Cursor without extensions: close Cursor → in the terminal: cursor --disable-extensions.
  2. Go to Settings > Network > Run Diagnostics, then enable “Disable HTTP/2” and restart Cursor.
  3. Clear the cache and restart the dev server: rm -rf .next node_modules/.cache && npm run dev.
  4. Run the project without Turbopack (next dev) and separately with Turbopack (next dev --turbo). Is there a difference?
  5. Compare running the dev server outside Cursor (iTerm/Terminal) and inside Cursor’s built-in terminal:
    • Output env: printenv | sort (in both cases)
    • Versions: Help > About (full), node -v, npm/yarn/pnpm -v, npm ls next
  6. Send: next.config.js, code app/api/leads/[leadId]/links/route.(ts|js) (GET/POST), full terminal log on 500 error (with “params as a Promise”/“Lead not found” line), export Network/Console for the 500 request.
  7. If possible - a minimal public repository with reproduction.

Known issues: Turbopack + Cursor often causes dev server crashes. If you’re using Next.js 13.5.4 - try downgrading to 13.5.3. In App Router, use NextResponse.json() instead of the old res.json().

Once we get a reproduction or confirmation that the 500 error occurs only when running the dev server inside Cursor (and, for example, only with Turbopack/HTTP2/extensions), I’ll pass it to the team.