qwertyuiop
qwertyuiop
CDCloudflare Developers
Created by qwertyuiop on 8/14/2024 in #pages-help
Is react cache supported?
Hi, I'm developing in nextjs and deploying on cloudflare pages. Recently I'm exploring ways to move net requests to the server side to make client side simpler. One challenge is to cache the requests on server side. I learned that react has cache support like this:
import { SupabaseClient } from '@supabase/supabase-js';
import { cache } from 'react';

export const getUser = cache(async (supabase: SupabaseClient) => {
const {
data: { user }
} = await supabase.auth.getUser();
return user;
});
import { SupabaseClient } from '@supabase/supabase-js';
import { cache } from 'react';

export const getUser = cache(async (supabase: SupabaseClient) => {
const {
data: { user }
} = await supabase.auth.getUser();
return user;
});
I found some related docs https://developers.cloudflare.com/pages/framework-guides/nextjs/ssr/caching/ but it seems to be about fetch() calls. Does it work for react cache too?
1 replies
CDCloudflare Developers
Created by qwertyuiop on 5/29/2024 in #pages-help
Nextjs api routes edge runtime costs & limits
Hi, I'm new to cloudflare pages. I've deployed a nextjs website with api routes running on edge runtime. It's working smoothly so far. Only question is I don't see anything about requests to api routes on the pricing page. Is there any limit to the number of requests sent to the api routes? Or is it unlimited like any other static pages? Also I'm planning to deploy a long running function and I wonder if the edge runtime has a maximum timeout set for api routes.
5 replies