Next.js Discord

Discord Forum

How to return HTTP error codes (400 - 500) from Server Components?

Unanswered
Airedale Terrier posted this in #help-forum
Open in Discord
Airedale TerrierOP
Hello, I have an issue with the server components return 200 status even when encountering errors.

This makes it so the logs don't appear as error logs both in Vercel and DataDog.

How can I return HTTP error codes from Server Components?

I'm aware of notFound(), but that's only for 404

2 Replies

Philippine Crocodile
Airedale TerrierOP
yikes, seems like a shortcoming. I wonder if there's a way to rearchitect app-dir apps to not rely on status codes as much