Vercel build hangs after adding an app router API route (Next.js 14.2)

Hi!

I am implementing a simple chat POC into our Next.js 14.2 app, using the pages router following this guide.

In the guide it states:

As long as you are on Next.js 13+, you can use Route Handlers (using the App Router) alongside the Pages Router. This is recommended to enable you to use the Web APIs interface/signature and to better support streaming.

This indeed works and builds just fine locally, but hangs during “Linting and type checking” when built on Vercel*,* and the build times out after 45 minutes.

I narrowed down the issue to the route handler file itself - without that file, it builds normally.

Additional information:

  • The app is inside a turborepo.
  • Everything is build on pages router (many hundreds of files)
  • Another interesting thing I’ve noticed:
    • The successful builds go in different order: First “Linting”, then “Creating optimized production build”
    • The ones that time out, first create the production build, prints “Compiled successfully” then start the “Linting”

Local system and package infos:

  • macOS 15.6.1 (M1 chip)
  • Node.js 22.16.0
  • TypeScript 5.8.3
  • Turbo 2.5.3
  • Next.js 14.2.3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.