Subsequent.js Has a Middleware Downside

Subsequent.js Has a Middleware Downside



Next.js

Subsequent.js has lengthy been positioned because the flagship React framework, powering numerous manufacturing apps throughout the net. Nonetheless, rising developer frustration is starting to show its limitations. 

A current weblog submit by developer Dominik Meca, titled ‘Subsequent.js is Infuriating’, struck a chord throughout the group in Hacker Information and Reddit, with many engineers echoing comparable ache factors. The problems should not remoted bugs; they replicate deeper cracks in how the framework handles middleware, logging and developer suggestions.

Meca units out with what needs to be a easy process: organising production-ready logging. As a substitute, what follows is a spiral of workarounds, damaged abstractions and unanswered questions. 

Meca’s verdict is unflinching. “How do you f**okay this up so dangerous? We’ve had middlewares since a minimum of the early 2010s when Specific got here out,” he wrote. From right here, the frustrations snowball as middleware refuses to chain, AsyncLocalStorage contexts mysteriously vanish mid-render and logging throughout consumer, server, and middleware turns into a break up, fragile course of.

The Points in Highlight

The core grievance largely centres round middleware, which Subsequent.js’s documentation describes as “notably helpful for implementing customized server-side logic like authentication, logging or dealing with redirects”.

But, in observe, Meca discovered that “you may go a grand complete of 4 parameters out of your middleware” and nothing past headers propagates downstream. His workaround was to stuff request IDs into headers simply to go knowledge to pages.

When even that broke, he tried shifting to a customized server, solely to search out the sample getting repeated there as effectively, with AsyncLocalStorage nonetheless failing to behave as anticipated.

This isn’t only one engineer’s rant. Different builders have echoed comparable considerations. 

Utkarsh Kanwat, an engineer at ANZ, informed AIM that past the chaining points, the AsyncLocalStorage issues are a dealbreaker for a lot of use circumstances.

“You’ll be able to’t share context between middleware and your precise utility code, which breaks distributed tracing, any refined auth patterns, and so on,” he stated.

He additionally argued that the shortage of context propagation makes Subsequent.js unsuitable for superior real-world necessities.

“The truth that you may’t reliably share context between middleware and your utility code in 2025 is fairly irritating, particularly when Specific and different frameworks solved this years in the past,” he added.

A Framework Falling Behind?

Meca’s submit attracts a pointy distinction between Subsequent.js and SvelteKit, one other framework backed by Vercel. 

The place Subsequent.js middleware struggles even with fundamentals, SvelteKit helps chaining, request-scoped knowledge and composability. 

As Meca put it bluntly, “That is what actual engineering appears like. SvelteKit is a Vercel product. How is the flagship providing worse than what is actually a aspect mission?”

Kanwat bolstered this level, arguing that Subsequent.js makes builders work towards the framework for something past primary use circumstances. “It’s irritating as a result of these needs to be solved issues by now.”

Vishwa Gaurav, software program improvement engineer at Groww, supplied a barely extra measured perspective to AIM. He identified that Subsequent.js’ middleware is highly effective for easy, latency-sensitive duties because it runs earlier than the route handler and helps edge runtime. Nonetheless, for richer, composable or complicated workflows, its limitations make frameworks like SvelteKit extra interesting.

Furthermore, highlighting a key distinction in strategy, he stated that in contrast to devoted middleware programs, SvelteKit employs hooks to intercept and modify requests and responses, whereas including that Vercel ought to present “built-in utilities or patterns that facilitate the administration of request-scoped knowledge, lowering the necessity for a customized server.”

The Bigger Frustration

Beneath the middleware debate lies a deeper cultural frustration: responsiveness. Builders akin to Meca describe the Subsequent.js GitHub concern tracker as a “crown jewel of the dumpster hearth,” the place “hopes and points come to die”. 

“The imply response time for a bug report isn’t,” Meca claimed, citing a number of points that obtained silence regardless of detailed reproductions.

Kanwat agrees. “Truthfully, the GitHub response occasions are regarding, however haven’t stopped me from utilizing Subsequent.js but,” he stated, including that the worrying half is the precise efficiency regressions that preserve displaying up, akin to huge construct slowdowns in current variations that take months to get mounted.

“The problem isn’t simply gradual responses, it’s that many efficiency issues appear to get launched after which take without end to resolve,” he added.

For tasks of important significance, Kanwat suggested higher warning. He admitted that it’s higher to train higher warning and constantly pin particular variations as a substitute of counting on computerized updates.

The sentiment will not be common. Gaurav discovered Vercel engineers responsive on social media and optimistic in addressing requests. But, the bigger frustration stays {that a} framework of this scale leaves builders break up between hacks, customized servers or totally totally different instruments.

What’s Subsequent For Subsequent.js?

“Personally, I don’t wish to use Subsequent.js anymore,” Meca admitted. Whereas he admitted he lacks the leverage to maneuver his whole firm away, the expertise has eroded his belief within the framework. 

Many builders might proceed to depend on Subsequent.js, however typically with warning, workarounds or pinned variations to keep away from regressions.

What emerges is much less a single bug and extra a sample: middleware that doesn’t propagate context, AsyncLocalStorage that fails the place it’s wanted most, and a difficulty tracker seen as unresponsive. Collectively, these level to a framework caught between its ambitions and a faltering developer expertise. 

With alternate options like SvelteKit providing higher flexibility, the cracks in Subsequent.js’s dominance are beginning to widen.

The submit Subsequent.js Has a Middleware Downside appeared first on Analytics India Journal.

Leave a Reply

Your email address will not be published. Required fields are marked *