SupabaseS
Supabase6mo ago
Noodle

AuthApiError: Request rate limit reached — is something wrong?

Hey everyone. I am about to launch an app but am on the free plan currently. I was thinking I needed to upgrade to the Pro plan but I am reading that there could be an issue in my code causing this error.

The app is built in Remix and am unsure if the logs I am seeing are out of the ordinary and causing the API rate limit to be hit (I can get this message if I quickly reload the page ~5 times.)

AuthApiError: Request rate limit reached
  ...
  __isAuthError: true,
  status: 429,
  code: 'over_request_rate_limit'
}


Here is my server client file:

import { createServerClient, parse, serialize } from "@supabase/ssr";

export const createSupabaseServerClient = (
    request: Request,
    serviceRole?: boolean,
) => {
    const cookies = parse(request.headers.get("Cookie") ?? "");
    const headers = new Headers();

    const supabaseKey = serviceRole
        ? process.env.SUPABASE_SERVICE_ROLE_KEY
        : process.env.SUPABASE_ANON_KEY;

    const supabaseClient = createServerClient(
        process.env.SUPABASE_URL as string,
        supabaseKey as string,
        {
            cookies: {
                get(key) {
                    return cookies[key];
                },
                set(key, value, options) {
                    headers.append("Set-Cookie", serialize(key, value, options));
                },
                remove(key, options) {
                    headers.append("Set-Cookie", serialize(key, "", options));
                },
            },
            ...(serviceRole && {
                cookieOptions: {
                    name: "no-cookie-for-you",
                },
            }),
        },
    );

    return { supabaseClient, headers };
};


And my supabase versions:

        "@supabase/ssr": "^0.3.0",
        "@supabase/supabase-js": "^2.43.4",


Thank you!
image.png
Was this page helpful?