RSC Logs Showing Binary Output While Middleware Shows JSON — Normal or Bug?
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
Hey everyone, I need help understanding a weird behavior in Next.js 16
I’m calling the same backend function from two places:
Next.js Middleware (Edge Runtime)
A React Server Component (RSC) page
In Middleware, the response is totally normal JSON.
But when the same function is called inside an RSC page, the logs show binary / unreadable output, like this:
The middleware logs show clean JSON (session + user data), but the RSC logs look corrupted.
Example of the normal middleware output:
The same endpoint, same headers, same fetch.
am i missing something here ?
I’m calling the same backend function from two places:
Next.js Middleware (Edge Runtime)
A React Server Component (RSC) page
In Middleware, the response is totally normal JSON.
But when the same function is called inside an RSC page, the logs show binary / unreadable output, like this:
(�/�X�YS'���X4��p�@l#�TI~�T��w�rEQ��0�3/FKJ�1���
��<�N�
��ϋ�D1�n6����["�q�PS�W�]B�W�I��V�z4�7��+���The middleware logs show clean JSON (session + user data), but the RSC logs look corrupted.
Example of the normal middleware output:
{
session: {
expiresAt: "2025-12-23T22:40:55.859Z",
userId: "W9bHtwc5KnNUl2pyuIAYsFRQgIPyVrYq",
token: "hYDc3SoHQc38e18zSw64zG3qV...etc"
},
user: {
...
}
}The same endpoint, same headers, same fetch.
am i missing something here ?
8 Replies
Polar bearOP
Also locally it works perfectly fine
Sun bear
how are you logging this
are you checking the network tab in your browser when you press the button?
because i think what youre looking at is the component stream and not the data itself
the data goes to the server and the server calculates the HTML and sends it to the browser instead of sending the browser JSON and making the javascript figure out how to turn it to html
Polar bearOP
no, im just console.log it on the server and this logs are from the vercel dashboard logs
bwt this only happening at vercel, my hole app got broken of this logic
so i tried netlify, cloudflare everything is working fine as expected