ENOENT Error When Dynamic Routes Include Emojis
Unanswered
Brown bear posted this in #help-forum
Brown bearOP
Im trying to figure out if I need to raise this as a bug, if this is expected behaviour (and is documented), or if Im just going insane.
After creating a basic api route such as the following
And then running
The issue
When going to
What have you tried?
I've tried all I can think of, encoding the emoji, not encoding the emoji, trying to catch it on the route handler. The cause seems to be in (https://i.cjcapps.co.uk/2024/02/11/IllustriousLeafbird.jpg - See Attachment) as if I remove the decodeURIComponent the error seems to stop, although im sure this would cause other issues...
Version?
Im currently experiencing this on
Any ideas would be great, or if a bug report needs creating I will start making a standalone repo for reproduction, but I am hoping someone here knows the answer! Thanks!
After creating a basic api route such as the following
api/users/search/[query]/route.tsimport { NextRequest, NextResponse } from "next/server";
export async function GET(
req: NextRequest,
{ params }: { params: { query: string } }
) {
const query = params.query;
return new NextResponse(JSON.stringify({ queryWas: query }), { status: 200 });
}And then running
npm run dev and navigating to the URL with a valid parameter EG: http://localhost:3000/api/users/search/TestUser the page returns as expected {"queryWas":"TestString"} and nothing is logged in the server console The issue
When going to
http://localhost:3000/search/%F0%9F%93%99 (Encoded Version of 📙) the page still returns as expected {"queryWas":"📙"} ... BUT... in the server console, the following error is printed (https://i.cjcapps.co.uk/2024/02/11/NumbNightheron.jpg) - See Attachment. What have you tried?
I've tried all I can think of, encoding the emoji, not encoding the emoji, trying to catch it on the route handler. The cause seems to be in (https://i.cjcapps.co.uk/2024/02/11/IllustriousLeafbird.jpg - See Attachment) as if I remove the decodeURIComponent the error seems to stop, although im sure this would cause other issues...
Version?
Im currently experiencing this on
14.1.0 & 14.1.1-canary.47.Any ideas would be great, or if a bug report needs creating I will start making a standalone repo for reproduction, but I am hoping someone here knows the answer! Thanks!
5 Replies
Asian black bear
having the same problem did you figure out a way to fix it?
@Asian black bear having the same problem did you figure out a way to fix it?
Brown bearOP
Never found a fix I removed the need to search for emojis and as such the error stopped
@Brown bear Never found a fix I removed the need to search for emojis and as such the error stopped
Asian black bear
Ah I see, thank you.
I guess for the time being, I have to just deal with having my console spammed^^
I guess for the time being, I have to just deal with having my console spammed^^