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

    Arthur

    02/16/2023, 8:37 AM
    As it is required for svelte kit.
  • a

    Arthur

    02/16/2023, 8:59 AM
    I'll probbably use the mailchannels using a fetch method tho
  • i

    izdipro

    02/16/2023, 4:57 PM
    Hey folks, currently building a simple API on functions. I wonder if there is a way to install 3rd-party node packages rather than building plugins?
  • w

    Walshy | Pages

    02/16/2023, 5:57 PM
    npm i --save <package>
    and
    import x from 'y'
    🙂
  • i

    izdipro

    02/16/2023, 7:26 PM
    that doesn't seem to be the case for a next.js project which is not running on edge runtime :/
  • s

    Skye

    02/16/2023, 7:26 PM
    We don't have much info to go on to help you there
  • a

    ajgeiss0702

    02/16/2023, 10:41 PM
    Is something like “top paths” able to be added to functions metrics (or is there any way to see something like that)? (Please ping if you reply)
  • w

    Walshy | Pages

    02/16/2023, 10:44 PM
    We don't have that data so we are unable to share it. You can log it yourself however with #981314061268578304
  • a

    ajgeiss0702

    02/16/2023, 10:45 PM
    Ah, I saw that but thought this might be a better fit. Thanks for the info 🙂
  • g

    Georgi Vatsov

    02/17/2023, 12:39 PM
    Hello! I am new to Functions and I have a Pages (next.js) project to which I want to add some dynamic content. I created a Edge API route and when deployed it works fine, but I cannot figure out how to test it locally with my freshly created KV store. Do I need
    wrangler
    or something else?
  • j

    jabb

    02/17/2023, 6:16 PM
    I have this same question. It appears that the
    --experimental-local-remote-kv
    option is only available on
    wrangler dev
    and not
    wrangler pages dev
    . Does anyone know if there is an option here?
  • s

    Skye

    02/17/2023, 6:17 PM
    To be fair, none of pages dev uses anything remote - it's all miniflare
  • j

    jabb

    02/17/2023, 6:31 PM
    How are folx priming their cloudflare pages kv dataset for local testing? I have a script that primes it for production by invoking wrangler, but it's unclear how to do something similar for local dev.
  • s

    Skye

    02/17/2023, 6:32 PM
    when you're using
    --persist
    , it'll use the filesystem for storing KV, R2, etc. so you could use that?
  • j

    jabb

    02/17/2023, 6:34 PM
    That makes sense, but isn't really a 'bulk load' model. You'd have to write functions that persist kv data to support it I suppose.
  • h

    HardAtWork

    02/17/2023, 6:54 PM
    You can just copy the data from a source, and then dump it into the file manually
  • m

    Max Elia

    02/17/2023, 7:38 PM
    Built this Proof of concept for Session-based user authentication with Pages Functions, KV and static HTML. Passwords are salted with random values and peppered with SECRET environment variable. Is this method actually secure? https://github.com/max-elia/poc-kv-auth
  • j

    jabb

    02/17/2023, 9:18 PM
    That sounds like the right thing to do! Is there a format/filename described somewhere?
  • h

    HardAtWork

    02/17/2023, 9:22 PM
    Try `put`ing a single value, you should see the format then
  • t

    TL&D

    02/18/2023, 4:08 AM
    cloudflare pages deploy Failed: unable to submit build job
  • t

    TL&D

    02/18/2023, 4:15 AM
    github is dead.
  • t

    TetraEtc

    02/18/2023, 10:12 AM
    Github appears to be back for anyone watching
  • t

    TetraEtc

    02/18/2023, 10:13 AM
    I appear to be having issues with getting functions working. I'm deploying through github integration, and have placed a file under
    functions
    directory, so it's
    functions/submit.js
    - when the deployment occurs I keep getting
    No routes found when building Functions directory: /opt/buildhome/repo/functions
    though
  • t

    TetraEtc

    02/18/2023, 10:13 AM
    All the docs I have read indicate that the route file should be automatically generated for me?
  • h

    HardAtWork

    02/18/2023, 10:14 AM
    Is your repo public?
  • s

    Skye

    02/18/2023, 10:15 AM
    If not the repo, at least the code for the function
  • t

    TetraEtc

    02/18/2023, 10:15 AM
    negative, but it's essentially just a nuxt 3 project with the
    functions
    directory
  • s

    Skye

    02/18/2023, 10:16 AM
    Nuxt will make it's own functions which mess with yours
  • t

    TetraEtc

    02/18/2023, 10:16 AM
    Oh you're gonna love the function code...
    Copy code
    /**
     *
     * @param context EventContext
     */
    function onRequestPost(context) {
    return new Response(context)
    }
  • s

    Skye

    02/18/2023, 10:16 AM
    You'll instead want to use their server endpoints to create functions
1...346347348...392Latest