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

    Walshy | Pages

    01/09/2023, 6:03 PM
    Function + client side fetch to put and get
  • g

    Glare

    01/09/2023, 6:06 PM
    So the /functions/helper.js for example would transform into something like
    domain.tld/helper
    which could be fetched via PUT with the data from the Nuxt page and in the helper.js just check if it's a GET or a PUT, and if it's a put, enter it into the KV and if it's a get, get it from the KV? Do I have that logic correct?
  • z

    zszszsz

    01/09/2023, 9:58 PM
    Is it the same kv for wrangler pages dev --kv , or is it a local alternative ?
  • s

    Skye

    01/09/2023, 10:12 PM
    Pages Dev uses a local version of KV (and all of your other bindings)
  • s

    Skye

    01/09/2023, 10:12 PM
    It'll be in memory by default though, if you want it to use your filesystem, you should also include a
    --persist
  • z

    zszszsz

    01/09/2023, 10:16 PM
    So if I want to give it some values in prior, where should I declare them ?
  • z

    zszszsz

    01/10/2023, 12:38 AM
    Even if there are some entries in
    .wrangler/state/kv/${namespace}/
    ,
    --persist
    is still required.
  • z

    zszszsz

    01/10/2023, 12:39 AM
    not a very pleasant behavior
  • s

    Srd

    01/10/2023, 5:46 AM
    Does somebody have a recommendation for something like Prisma working within Pages Functions?
  • z

    zszszsz

    01/10/2023, 6:11 AM
    no prisma no
  • z

    zszszsz

    01/10/2023, 6:13 AM
    if you anyway need to establish the DB connection elsewhere, why not run prisma itself from the "elsewhere".
  • s

    Srd

    01/10/2023, 6:45 AM
    If you're replying to me: I’m trying to run it either from a Worker or Pages, with a preference on having whatever in the pages as well
  • e

    Epailes

    01/10/2023, 1:17 PM
    https://www.prisma.io/docs/guides/deployment/deployment-guides/deploying-to-cloudflare-workers You can but you need to use their data proxy which has additional costs
  • s

    shmshd

    01/10/2023, 5:40 PM
    Is node v18 error at build time a known issue for Cloudflare Pages?
  • k

    kian

    01/10/2023, 5:42 PM
  • k

    kian

    01/10/2023, 5:42 PM
    It'll be supported in the new build image
  • k

    kian

    01/10/2023, 5:42 PM
    https://github.com/cloudflare/pages-build-image/discussions/1
  • s

    shmshd

    01/10/2023, 5:46 PM
    cool. This is what I was looking for. Thanks
  • z

    zszszsz

    01/10/2023, 10:15 PM
    hope it will be available sooooooooooooooooon
  • z

    zszszsz

    01/10/2023, 10:16 PM
    message has been deleted
  • z

    zszszsz

    01/10/2023, 10:17 PM
    So, just use d1. forget about prisma.
  • x

    x86chi

    01/11/2023, 10:09 AM
    How can I redirect using functions? I want to try redirecting to a specific path like
    /app.html
    when trying to access to any path other than the root path. ex) / -> / /asdf -> /app.html Is it possible using functions? I already try
    _redirect
    with below source. but the root path is also being moved to the path to be redirected.
    Copy code
    /* /app.html
  • k

    KamiQuasi

    01/11/2023, 5:07 PM
    Looking for ideas to try. I'm attempting to serve a R2 file using _middleware from the pages domain. Bucket is bound, and the Response is getting hit, but the file keeps firing off a download dialog instead of being parsed properly by the browser. Was going off of this doc, plus some request capturing in the middleware for the specific file (e.g. -
    https://mydomain.com/index.pck
    ,
    https://mydomain.com/index.wasm
    ), but can't seem to hit the sweet spot where the browser just uses the file and doesn't try to download it: https://developers.cloudflare.com/r2/data-access/workers-api/workers-api-usage/
  • z

    zszszsz

    01/11/2023, 5:52 PM
    Is the
    Content-Type
    properly set ?
  • n

    Nico

    01/11/2023, 6:30 PM
    Can you set a specific function in pages to be unbound?
  • n

    Nico

    01/11/2023, 6:31 PM
    I dont want all functions to behave unbound, just some I specify.
  • w

    Walshy | Pages

    01/11/2023, 6:35 PM
    yep in project settings -> https://dash.cloudflare.com?to=/:account/pages/view/:pages-project/settings/functions
  • u

    Unsmart | Tech debt

    01/11/2023, 6:49 PM
    you didnt fully read 😛 its either all or none are unbound unless im missing something on there
  • w

    Walshy | Pages

    01/11/2023, 6:49 PM
    You can change Unbound on a per-project level or globally
  • w

    Walshy | Pages

    01/11/2023, 6:50 PM
    they want per-project... I think?
1...329330331...392Latest