Constant requests to a 404 page?
Unanswered
Eastern yellowjacket posted this in #help-forum
Eastern yellowjacketOP
Hi, I have protected a route by checking if a certain chatId in the chat/[chatId] url belongs to a user. If it does not, I return notFound(). When testing it with an unauthorised user, I get the expected result of a 404 page, but I see in the server log that there are constant requests being made to this page. Any idea why that could be?
Here is the code in question:
The
Thanks for any help!
Here is the code in question:
export default async function Page({ params }: PageProps) {
const { chatId } = params;
const { userId } = auth();
if (!chatId || !userId) {
notFound();
}
const validUser = await ValidateUserFromChat(chatId, userId);
if (!validUser) {
notFound();
}
return (
<div>
<div>{chatId}</div>
</div>
);
}The
ValidateUserFromChat function simply takes in the chatId, a userId, and sees if the user has access to this chat. Thanks for any help!