So i have a client side where there’s a button. The button calls a Server Action (Server Function) and it all works well. But i can’t access the request of the client. Such as if i want to rate limit the user so they can’t spam it.
request returns undefined.
neither do i want to send their ip from the client because then i would have to trust the client and its easy to spoof the parameters.
'use client';
import { Test } from '@/app/actions/test';
export default function TestPage() {
return <button onClick={() => Test()}>Test</button>;
}
'use server';
import { NextRequest } from 'next/server';
export async function Test(request: NextRequest) {
console.log(request);
}
All links on google are purple i have not found a solution to this problem.