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

    kavinplays

    11/20/2021, 9:04 AM
    That's what I think it is, it is ssr now so each request would count as a function hit i think
  • i

    itsmatteomanf

    11/20/2021, 10:53 AM
    Even if it did fetch the static file it would count as a function run, if you deploy a
    _worker.js
    file or a
    functions/[[path]].js
    , because there run on all paths.
  • k

    kavinplays

    11/20/2021, 10:54 AM
    Yup, that's what I meant
  • w

    wonkrattle

    11/20/2021, 1:47 PM
    But if your function has a specific name it will only run when that path is requested, right
  • w

    wonkrattle

    11/20/2021, 1:48 PM
    Does the build count reset at the end of the calendar month? Or at some other point?
  • k

    kavinplays

    11/20/2021, 2:34 PM
    start of a month iirc
  • k

    kavinplays

    11/20/2021, 2:34 PM
    no, they run on all paths and check to run code or not on that page
  • w

    wonkrattle

    11/20/2021, 3:02 PM
    This is a dumb question, but if for example my only function is hello-world.js, how could it need to be run on every page?
  • k

    kavinplays

    11/20/2021, 3:13 PM
    well, this is how i understand it, there is some dynamic ability of functions as in which pages they run on, to get this, there is a worker invocation which then decides if it needs to do something to that page or not
  • g

    gerred

    11/20/2021, 3:30 PM
    yeah, I'm working on seeing if I can't separate the functions out into separate functions files so requesting images/js/css/prerendered routes doesn't generate a function run but I don't think that's going to be terribly easy in the context of sveltekit.
  • g

    gerred

    11/20/2021, 3:31 PM
    i generated 275 function uses in 22 requests, mostly from the split JS that sveltekit imports. on the good front, it's cahceable, still a little wasteful though.
  • k

    kavinplays

    11/20/2021, 3:33 PM
    how does the cache work for it?
  • k

    kavinplays

    11/20/2021, 3:33 PM
    if it's the same as workers, those count as function runs too
  • g

    gerred

    11/20/2021, 3:33 PM
    works great, I was intentionally generating unique requests just to see.
  • g

    gerred

    11/20/2021, 3:33 PM
    it didn't seem to in this case.
  • k

    kavinplays

    11/20/2021, 3:33 PM
    i think this is a beta hiccup, there will atleast be a way that it is not run on some files like css and images
  • g

    gerred

    11/20/2021, 3:34 PM
    yeah it'd be nice if anything hitting env.ASSETS didn't count.
  • k

    kavinplays

    11/20/2021, 3:34 PM
    is that browser cache?
  • g

    gerred

    11/20/2021, 3:34 PM
    ah, yes, not cloudflare cache. I should've checked that.
  • k

    kavinplays

    11/20/2021, 3:34 PM
    yea
  • k

    kavinplays

    11/20/2021, 3:34 PM
    makes sense
  • d

    dis01

    11/20/2021, 3:57 PM
    I've run into what I think is a bug in Windows on running the local compile: npx wrangler pages dev ./.svelte-kit/cloudflare/
  • d

    dis01

    11/20/2021, 4:01 PM
    Continued: The plinko.mjs on line 133 is outputting ${filepath} to routes.mjs but that is not escaping the "\" for windows: ../../../../../Users/aaa/AppData/Local/Temp/plinko-LEAo6U/routes.mjs:1:55: error: Could not resolve "C:aaaDevjavascriptsvelte\testWithCF\functions\test.js" (mark it as external to exclude it from the bundle)
  • d

    dis01

    11/20/2021, 4:04 PM
    escaping the "backslash" for windows
  • m

    Mark Hood

    11/20/2021, 4:41 PM
    Loving the new feature! But I am having an issue experimenting with KV. It works fine when I deploy, since I've set up the binding there. But when I try to run locally with wrangler 2.0 beta, it can't see the binding... And so it can't see the KV namespace. Any ideas?
  • i

    itsmatteomanf

    11/20/2021, 5:21 PM
    Have you added the binding in the local command?
  • g

    gerred

    11/20/2021, 8:24 PM
    @User is the cloudflare cache counting as a worker invocation still (or still invoking the worker) documented anywhere?
  • g

    gerred

    11/20/2021, 8:24 PM
    i'm putting together a feature request/feedback and just wanted to cite things if possible
  • w

    wonkrattle

    11/20/2021, 9:13 PM
    So in a function, what counts as an invocation request?
  • i

    itsmatteomanf

    11/20/2021, 9:43 PM
    Any request to a path where it runs. All requests to the site if you have a
    _worker.js
    , all covered paths if you use the
    /functions
    folder.
1...456...392Latest