https://discord.cloudflare.com logo
Join Discord
Powered by
# functions
  • p

    PaganMuffin

    05/27/2023, 8:22 PM
    Does Cache API with custom cache-control work on pages.dev (preview)? Because it cached as it should, but isn't expired after 60 seconds
    Copy code
    ts
    export const getContacts = async (
        CF: WorkerRuntime<Env> | PagesRuntime<Env, unknown>
    ): Promise<string | null> => {
        const cache = await caches.open("pages");
    
        const cacheKey = `https://example.com/pages/contact`;
    
        const cachedAbout = await cache.match(cacheKey);
        if (cachedAbout) {
            console.log("CACHE");
            return await cachedAbout.json();
        }
    
        console.log("non-cache");
    
        const contact = await CF.env.SETTINGS.get<string>("pages/contact");
    
        CF.waitUntil(
            cache.put(
                cacheKey,
                new Response(JSON.stringify(contact), {
                    headers: { "Cache-Control": "max-age=60" },
                })
            )
        );
    
        return contact;
    };
  • w

    Walshy | Pages

    05/27/2023, 8:35 PM
    It can only go as low as your zone plan allows
  • e

    Erisa | Support Engineer

    05/27/2023, 8:48 PM
    considering > on pages.dev (preview) I would think it would be held to the limitations of the free plan in that case
  • p

    PaganMuffin

    05/27/2023, 8:57 PM
    So it would be min. 2 hour (edge cache) for free, thanks.
  • f

    Fπ™§π™€π™―π™šπ™£π™¨π™€π™žπ™‘

    05/28/2023, 1:20 AM
    did you figure out how to make this work?
  • b

    benank

    05/28/2023, 1:27 AM
    Let me see if I can find that project! It's been a while, and I can't remember if I ended up fixing it.
  • v

    Viper

    05/28/2023, 3:18 AM
    How about Prisma with Cloudflare pages? can't I use it instead of Mongoose and connect it to MongoDB or It wont work either
  • i

    Isaac McFadyen | YYZ01

    05/28/2023, 3:20 AM
    Same thing. Even though it's a different library it still needs to connect to MongoDB over TCP, and as far as I know Prisma hasn't implemented that yet.
  • i

    Isaac McFadyen | YYZ01

    05/28/2023, 3:20 AM
    If they have a place for feature requests you could submit that.
  • d

    DVD

    05/28/2023, 9:05 PM
    I have encountered an issue while using the Cloudflare Pages feature. When I tried to add an Internationalized Domain Name (IDN), I was unable to successfully add it to my page. I also attempted to convert the IDN to Punycode, but the problem still persists.
  • w

    Walshy | Pages

    05/28/2023, 9:10 PM
    what's your pages.dev?
  • d

    DVD

    05/28/2023, 9:41 PM
    idndemo.pages.dev
  • d

    DVD

    05/28/2023, 9:42 PM
    An unknown error occured. Contact your account team or Cloudflare support: https://cfl.re/3WgEyrH. (Code: 8000000)
  • d

    DVD

    05/28/2023, 9:45 PM
    xn--0zwm56d.xyz
  • w

    Walshy | Pages

    05/28/2023, 9:51 PM
    try again now
  • d

    DVD

    05/28/2023, 9:58 PM
    Other accounts are unable to add.
  • w

    Walshy | Pages

    05/28/2023, 10:06 PM
    you still can't add it?
  • d

    DVD

    05/28/2023, 10:11 PM
    Yes, on another account
  • d

    DVD

    05/28/2023, 10:15 PM
    In SSL/TLS Custom Hostnames and Fallback Origin, it is not possible to use IDN domain names
  • w

    Walshy | Pages

    05/28/2023, 10:17 PM
    It is
  • w

    Walshy | Pages

    05/28/2023, 10:17 PM
    But you may be selecting a CA which doesn't support it
  • w

    Walshy | Pages

    05/28/2023, 10:17 PM
    However, that falls outside my scope. I can help with Pages not SSL for SaaS
  • d

    DVD

    05/28/2023, 10:20 PM
    It's not a problem with the certificate authority. When adding an IDN domain name, the message 'You must use a valid domain name.' is displayed. After conversion, the message 'You must use a hostname that is a part of your zone.' is displayed.
  • d

    DVD

    05/28/2023, 10:34 PM
    Spectrum cannot add an IDN domain name either, it prompts 'Invalid Domain'
  • w

    Walshy | Pages

    05/28/2023, 10:35 PM
    Not sure about Spectrum
  • w

    Walshy | Pages

    05/28/2023, 10:35 PM
    SSL for SaaS 100% can since you can on Pages and we use it
  • w

    Walshy | Pages

    05/28/2023, 10:35 PM
    but again, this is not in my scope I'd recommend going to #1104040620948992090 and someone with more knowledge can help out
  • w

    Walshy | Pages

    05/28/2023, 10:46 PM
    done
  • Quick question around `pages dev`
    q

    quambo

    01/03/2024, 12:41 PM
    Noticed when I change a source file in
    trpc/src/
    folder, the log shows
    Copy code
    ✘ [ERROR] [proxy]: 
    
      [TypeScript] Found 0 errors. Watching for file changes.
    When I modify
    functions/trpc/[[endpoint]]/index.js
    , I can see the whole page reloading.
    • 1
    • 1
  • @auth/sveltekit! I have the same issue
    r

    Robin

    01/11/2024, 7:05 AM
    I added the nodejs_compat flag in the functions settings both envs, but builds still fail
    • 1
    • 1