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

    HardAtWork

    03/18/2023, 8:25 AM
    There are ways to secure it, but none are foolproof.
  • m

    My Account

    03/18/2023, 8:25 AM
    sad
  • z

    zszszsz

    03/18/2023, 10:42 PM
    Theoretically no. Theoretically it is not your site requesting the API . It is the browser, on behalf of the user, following the instruction of your site, requesting your API.
  • z

    zszszsz

    03/18/2023, 10:45 PM
    So the user can anyway request the API directly, pretending to be whatever "user agent" from whatever site, or just replay exactly the requests made by your site.
  • p

    Ponjimon

    03/19/2023, 7:39 PM
    Can someone explain to me how I can make functions work using Wrangler CLI and Direct Upload in Pages?
  • p

    Ponjimon

    03/19/2023, 7:40 PM
    the
    functions
    directory is included in the folder I give the CLI when publishing, but the function is nowhere to be found afterwards and the deployment just gives a blank 404 page
  • e

    Erisa | Support Engineer

    03/19/2023, 7:41 PM
    the
    functions
    directory needs to be in the current directory when running wrangler, not the given output directory
  • p

    Ponjimon

    03/19/2023, 7:41 PM
    Is that stated anywhere in the docs?
  • e

    Erisa | Support Engineer

    03/19/2023, 7:42 PM
    "root of your Pages project"
  • p

    Ponjimon

    03/19/2023, 7:43 PM
    Thanks. How would that be possible in a monorepo? I read that Direct Upload is the way to go for that but if that's limited to the root directory, monorepos don't seem to be supported at all 😦
  • e

    Erisa | Support Engineer

    03/19/2023, 7:43 PM
    hmm, could you not
    cd
    into the directory that holds the functions before publishing?
  • p

    Ponjimon

    03/19/2023, 7:43 PM
    let me try if that works
  • s

    Skye

    03/19/2023, 7:43 PM
    that's what I'd do, yeah
  • p

    Ponjimon

    03/19/2023, 7:44 PM
    Would that also work with https://github.com/cloudflare/pages-action this? Like, cd'ing into it?
  • e

    Erisa | Support Engineer

    03/19/2023, 7:44 PM
  • e

    Erisa | Support Engineer

    03/19/2023, 7:44 PM
    set
    workingDirectory: YOUR_PACKAGE_DIRECTORY
  • p

    Ponjimon

    03/19/2023, 7:45 PM
    ah nice
  • p

    Ponjimon

    03/19/2023, 7:46 PM
    That seems to do the trick, nice 🙂 Hopefully the Git Integration eventually supports Monorepos though :D, but that's for #920749372256419930
  • s

    sdev

    03/20/2023, 12:43 PM
    Any solution to syntax highlight code block in markdown file in Pages Functions enviroment? I tried to use shiki + @markdoc/markdoc but shiki doesn't work in Functions env.
  • j

    jschlesser

    03/20/2023, 8:45 PM
    If im compiling a pages project to a worker (its sveltekit), do the workers limits on file size of the worker apply to the pages worker.js file?
  • h

    HardAtWork

    03/20/2023, 8:46 PM
    Yes
  • h

    hanpolo

    03/21/2023, 5:49 AM
    Are there any docs about durable objects development with functions? Do we have to upload them with Wrangler or does the pages project take care of this? How about local development?
  • h

    HardAtWork

    03/21/2023, 7:10 AM
    You have to upload a separate Worker
  • b

    bbong

    03/21/2023, 6:56 PM
    not sure if this is the right place to ask but I am try to figure out setting and modifying cookies with page functions and I have having an issue with trying to force a deletion of a cookie
    • 1
    • 2
  • z

    zszszsz

    03/21/2023, 11:21 PM
    Is there an env for addEventListener('fetch',...) ?
  • k

    kian

    03/21/2023, 11:21 PM
    Nope, but if you're using Functions then you can't use that syntax anyways.
  • k

    kian

    03/21/2023, 11:22 PM
    Bindings for Service Workers (using
    addEventListener
    ) are globals
  • z

    zszszsz

    03/21/2023, 11:22 PM
    Oh sry I thought this is worker
  • Manipulate local KV namespace
    b

    buckett

    03/22/2023, 9:49 AM
    Is it possible to manually add/edit/delete values from the local KV namespace when running Pages Functions locally? I couldn't see any way for wrangler to do this.
    s
    • 2
    • 1
  • t

    timesking

    03/22/2023, 4:56 PM
    Hi, I'm quite new to Cloudflare stack, I have a question when I'm looking into functions feature, some github project has a pages-functions-beta.json file, but I didn't see how wrangler use it.
1...358359360...392Latest