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

    Erisa | Support Engineer

    05/26/2023, 4:45 PM
    try replacing it with
    return Response.redirect(matchedUrl.url, 302);
  • s

    stukennedy

    05/26/2023, 5:27 PM
    ok ... just updated wrangler to v3 and I can't get Pages to work anymore. What's the breaking change? I have an index.ts in my functions folder exporting an onRequestGet: PagesFunction and when I run with
    wrangler pages dev ./static
    I get a 404
  • s

    stukennedy

    05/26/2023, 5:40 PM
    oh ignore me ... being an idiot!! I wrote
    onRequetGet
    instead of
    onRequestGet
    wish there was some typing for the exported supported PagesFunction names seeings as they are explicit.
  • j

    jameone

    05/27/2023, 12:44 AM
    Hello, having an issue as well with running a pages site and functions locally using: wrangler pages dev dist/cloudflare --compatibility-date=2021-09-20 when I try to hit my functions URLs I am getting my not found page on the site. if I change dist/cloudflare to just dist, I can get the function to run but no pages site. Any help is appreciated!
  • j

    jameone

    05/27/2023, 1:17 AM
    spent a little time experimenting and got it running using this COMMAND feature. Seems like a wild way to have to run this but got it working with: wrangler pages dev --proxy 8789 --compatibility-date=2021-09-20 --d1=DB --persist-to=db.sqlite -- wrangler pages dev dist/cloudflare --compatibility-date=2021-09-20 --port 8789
  • h

    HardAtWork

    05/27/2023, 5:09 AM
    Are you using a framework, by chance?
  • h

    HardAtWork

    05/27/2023, 5:10 AM
    It sounds like your Functions folder is in the wrong place
  • v

    Viper

    05/27/2023, 8:48 AM
    Does Cloudflare support Mongoose?
  • i

    Isaac McFadyen | YYZ01

    05/27/2023, 2:54 PM
    No, because Mongoose uses TCP connections. They actually are supported now in Workers/Functions, but because it's a non-standard API the package has to support it as well, and as far as I know Mongoose/MongoDB doesn't do that yet.
  • 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
1...388389390391392Latest