←back to thread

Next.js is infuriating

(blog.meca.sh)
1033 points Bogdanp | 8 comments | | HN request time: 0.001s | source | bottom
Show context
Rauchg ◴[] No.45100460[source]
Heard and appreciate the feedback. We’re well aware of the DX papercuts in Middleware. With 15.5 we made a big step in supporting Node runtime[1] which addresses a slew of issues people have reported over time.

If I went back in time, I would have called it Routing Middleware or Routing Handler. A specific hook to intercept during the routing phase, which can be delivered to the CDN edge for specialized providers. It’s also a somewhat advanced escape hatch.

Since OP mentions logging, it’s worth noting that for instrumentation and observability we’ve embraced OpenTelemetry and have an instrumentation.ts convention[2]

[1] https://nextjs.org/blog/next-15-5#nodejs-middleware-stable

[2] https://nextjs.org/docs/app/api-reference/file-conventions/i...

replies(8): >>45100602 #>>45100630 #>>45100658 #>>45100894 #>>45101395 #>>45101475 #>>45104120 #>>45108837 #
1. arnorhs ◴[] No.45101395[source]
First off, since the sentiment here is really negative, I'd like to say that next.js is actually really good for what it does. You've done a great job at building the software that powers millions of websites at this point.

I think a big part of the negative sentiment derives from the fact that detailed documentation and reference documentation almost non-existant. The documentation mostly tells you what exists, but not how to use them, how they get executed, common pitfalls and gotchas etc etc.

The documentation is written to be easy and friendly to newcomers, but is really missing the details and nuances of whatever execution context a given api is in and does not touch on derived complexities of using react in a server environment etc.

This is a trend across a lot of projects these days - often missing all the nuances and details - writing good documentation is really hard. Finding the balance between making things user friendly and detailed is hard.

Keep it up

replies(2): >>45101531 #>>45101559 #
2. mhitza ◴[] No.45101531[source]
Don't you find it problematic, as a framework that's 8 years old to already have reached version 15.x? Assuming they follow semantic versioning and those are 15 different backwards incompatible upgrades?
replies(3): >>45101989 #>>45102031 #>>45105852 #
3. icyJoseph ◴[] No.45101559[source]
> Finding the balance between making things user friendly and detailed is hard.

Thanks for the note! Indeed, it is also challenging when experience hides what things are not obvious or necessary to make further connections when reading the docs. It is an area of continuous improvement.

> The documentation is written to be easy and friendly to newcomers, but is really missing the details and nuances of whatever execution context a given api is in and does not touch on derived complexities of using react in a server environment etc.

I think on this particular topic, there had been an assumption made on the docs side, that, listing Edge runtime (when middleware was introduced), as its own thing, that might as well run in another computer, would also communicate that it does not share the same global environment as the underlying rendering server.

I'll do some updates to narrow this down again.

> The documentation mostly tells you what exists, but not how to use them, how they get executed, common pitfalls and gotchas etc etc.

Do you have anymore examples on this. I have been improving the revalidateTags/ Paths, layouts, fetch, hooks like useSearchParams, gotchas with Response.next, etc..

I know the OP post does talk about issues not being responded to, but that trend has been changing. If you do find/remember something as you describe, please do open a documentation issue, pointing to the docs page and the confusion/gotcha - we have been addressing these over the past months.

4. presentation ◴[] No.45101989[source]
Don’t think it’s semver.
replies(1): >>45102529 #
5. Vinnl ◴[] No.45102031[source]
Most of our upgrades have been fairly painless. Yes, they're not CI-succeeds Dependabot merges, but usually it's basically running the auto codemod and you're done, though I do always scan through the release notes and migration guide. That seems justified for the backbone of our application.
6. brazukadev ◴[] No.45102529{3}[source]
I think it is, that is why it is still unstable, 2 majors changes/year.
7. conradkay ◴[] No.45105852[source]
I haven't used next.js but it looks like they have mostly automatic/codemod migrations

`npx @next/codemod@canary upgrade latest`

replies(1): >>45120115 #
8. arnorhs ◴[] No.45120115{3}[source]
Yes, those have been really decent IIRC - don't remember ever having issues upgrading