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

    izak

    12/15/2022, 10:32 AM
    Hi! Is it possible to have a websocket server inside a pages function, or does this require a separate worker?
  • s

    Skye

    12/15/2022, 10:33 AM
    You should be able to use the same websocket stuff as normal workers can - see
  • s

    Skye

    12/15/2022, 10:34 AM
    You'll just have to slightly adapt the code to use the
    onRequest(Get/Post/etc)
    methods instead of
    handleRequest
  • i

    izak

    12/15/2022, 10:35 AM
    Ah amazing! Will give it a try, thanks (:
  • s

    Skye

    12/15/2022, 10:37 AM
    could you provide more info?
  • z

    zszszsz

    12/15/2022, 10:54 AM
    Looks like this one https://github.com/cloudflare/wrangler2/issues/1749
  • s

    shaharyarrrr

    12/16/2022, 1:19 PM
    How do u other function from nuxt ssr function?
  • q

    qbob

    12/16/2022, 9:13 PM
    hey there my workers env is an empty object. I'm trying to get the env.ASSETS.fetch functionality working, was wondering if anyone would be able to assist? I'm using advanced mode if that helps. Thanks! --EDIT-- I feel silly... wasn't using wrangler pages
  • z

    zszszsz

    12/17/2022, 7:34 PM
    Is
    Array.prototype.at
    really not supported in functions/workers runtime ?
  • z

    zszszsz

    12/17/2022, 7:34 PM
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at
  • z

    zszszsz

    12/17/2022, 7:39 PM
    oh nvm I may have followed some old instructions to use es2021 in tsconfig
  • z

    zszszsz

    12/18/2022, 12:15 AM
    Do pages.dev have caches API support ?
  • s

    Skye

    12/18/2022, 12:15 AM
    Yes
  • u

    Unsmart | Tech debt

    12/18/2022, 12:35 AM
    I would assume you probably still need a custom domain like workers but yeah
  • z

    zszszsz

    12/18/2022, 12:53 AM
    If I understand it correctly the Cache api is per data center, and can affect how cf responds to a non-function request right
  • z

    zszszsz

    12/18/2022, 12:57 AM
    I am thinking about PUTting sth into caches.default but that seems really dangerous
  • s

    Skye

    12/18/2022, 9:59 AM
    The cache will never run before you worker/function - you'll have to use cache.match to check if the item is there before returning it
  • s

    Skye

    12/18/2022, 10:00 AM
    And no, caches.default is not "dangerous" - it's still scoped to your account
  • z

    zszszsz

    12/18/2022, 10:17 AM
    But it may affect static requests, eg. override index.html or so ?
  • s

    Skye

    12/18/2022, 11:35 AM
    No, the cache API is specific to your worker
  • r

    ramu

    12/18/2022, 8:31 PM
    Hi, I'm new to Cloudflare. Anyone has a link to a tutorial or a github repo for simple form submission in sveltekit with page functions
  • j

    JohnsCreek

    12/19/2022, 3:00 PM
    https://developers.cloudflare.com/pages/framework-guides/deploy-a-svelte-site/#functions-setup
  • j

    JohnsCreek

    12/19/2022, 3:03 PM
    I am trying to deploy a minimum Cloudflare Pages with Function. When I publish the Pages project, I got no response from the route of
    /api
    . Any help here?
  • j

    JohnsCreek

    12/19/2022, 3:04 PM
  • j

    JohnsCreek

    12/19/2022, 3:06 PM
    I was trying to follow this guide by the way https://developers.cloudflare.com/pages/platform/functions/get-started/
  • r

    ramu

    12/20/2022, 1:06 AM
    @JohnsCreek yeah, I tried all that and more I'm not able to get the basic thing working so I asked 😦
  • l

    Larry

    12/20/2022, 3:14 AM
    Can someone provide an example of using the
    --do
    option for
    wrangler pages dev
    ? Nothing I've tried causes my durable objects to show up in the
    env
    object for my functions.
  • l

    Larry

    12/20/2022, 3:49 AM
    I'm trying to follow these instructions with no luck. "You must have theĀ apiĀ Workers service running in as anotherĀ wrangler devĀ process elsewhere already in order to reference that object." I'm using wrangler 2.6.2. I've tried it with and without
    --experimental-local
  • w

    W7T2A

    12/20/2022, 12:25 PM
    Hey guys, are there any limitations or some special setup needed when trying to access KV from CF functions? I tried accessing KV from local dev via wrangler but it seems bindings not work - neither I could get reading from KV work nor write some new keys. Is accessing KV from functions not supported?
  • s

    Skye

    12/20/2022, 12:57 PM
    With
    pages dev
    , you use the
    --kv
    flag for each namespace you want to add. for example
    wrangler pages dev --kv MY_BINDING
1...319320321...392Latest