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

    James

    01/17/2022, 11:18 PM
    Yeah that's accurate. There's a lot of services out there can send emails via an HTTP API, such as Sendgrid, Postmark, and lots more, but you can't send an email directly via Workers
  • j

    jschlesser

    01/19/2022, 12:04 AM
    Has anybody run into the need to put a multi line value in your environment variables? I need to save a PEM encoded private key in my local environment as well as save a different one in my production environment.
  • j

    jschlesser

    01/19/2022, 12:07 AM
    maybe this is another area to use KV till secrets support comes out?
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 2:50 AM
    Are environment variables set by pages like CF_PAGES available on
    context.env
    in a function?
  • e

    Erwin

    01/19/2022, 2:59 AM
    Pretty sure they should be? Isn't that the case?
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 3:00 AM
    I'm not seeing them in a Pages function... of course, thats with
    wrangler@alpha
    , so maybe it's not fully emulating a Pages Function context?
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 3:00 AM
    All I see when
    console.log()
    -ing
    context.env
    is
    ASSETS
    .
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 3:00 AM
    And I can't access
    context.env.CF_PAGES
    .
  • w

    Walshy | Pages

    01/19/2022, 3:01 AM
    99% sure they aren't
  • w

    Walshy | Pages

    01/19/2022, 3:01 AM
    They're only in the build env
  • w

    Walshy | Pages

    01/19/2022, 3:02 AM
    Would love to have the commit hash and branch in functions though, would be great to have that for Sentry
  • w

    Walshy | Pages

    01/19/2022, 3:02 AM
    Technically could still be done but it isn't ideal
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 3:04 AM
    Ok, thanks. As long as I know they're not supposed to be there and it's not just me, I can work around it. 🙂
  • e

    Erwin

    01/19/2022, 3:07 AM
    Ahh.. yes ofc @User. I forgot they are build only for now.
  • h

    halil

    01/19/2022, 2:46 PM
    Hi all, I deployed a sveltejs app, similar to cf-adapter example on github, I see pages is running functions, I also get data from api but I do not see any functions on deployment section on pages management part or worker page. I was wondering what would be correct configurarion of deploying so that this _worker.js becomes first class citizen, in the future I want to pass environment variables, get logs etc.
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 2:53 PM
    CF Pages Functions don't appear on the Workers page, as they are a separate entity. The only place you would be able to tell if they are working would be on the deployment under the Functions section (you'll see some JSON telling you on which routes they should be called).
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 2:55 PM
    Actually, if you are using a _worker.js they may not appear there. But you can take a look at the docs for environment variables etc: https://developers.cloudflare.com/pages/platform/functions#advanced-mode
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 2:56 PM
    As for logs, because Functions are still beta they aren't available yet. Once Functions hits GA they should be though (from what I'm told).
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 3:01 PM
    I'm seeing something strange with Functions. When I POST a form to the Function and parse the body all I get is a
    object
    (not FormData) with contents of
    {"locked":false}
    , not my actual form (which doesn't contain
    locked
    anywhere).
  • i

    Isaac McFadyen | YYZ01

    01/19/2022, 3:11 PM
    Duh, I need to use formData(). Sorry!
  • m

    Mladen

    01/19/2022, 3:36 PM
    Regards to all, I have a question about Browser Cache TTL. Specifically, I'm interested in how advisable it is to configure for ordinary sites and how much for woocommerce. Thanks!!!
  • h

    HardAtWork

    01/19/2022, 6:41 PM
    It all depends on how often your content updates. If it updates once a day, set it to somewhere around a day. But that is just a recommendation.
  • j

    julianbuse

    01/19/2022, 8:17 PM
    Hi,
  • h

    HardAtWork

    01/19/2022, 8:17 PM
    Hello!
  • j

    julianbuse

    01/19/2022, 8:17 PM
    I have a question about websockets in functions
  • j

    julianbuse

    01/19/2022, 8:17 PM
    do they work similarly to websockets in normal workers?
  • j

    julianbuse

    01/19/2022, 8:18 PM
    I'm trying to decide between developing with pages vs. with workers and workers sites
  • c

    Cоlе

    01/20/2022, 12:35 AM
    I don't know specifically for websockets, but most* features work identically
  • c

    Cоlе

    01/20/2022, 12:35 AM
    The only thing I haven't gotten to work is WASM
  • e

    Erwin

    01/20/2022, 1:33 AM
    Under the hood the Pages functions are compiled into one Worker.. so will support most of the same things. The only thing you are missing really is custom bundling/uploading support if you want to use the
    functions
    folder. You can always bundle your own thing in a
    _workers.js
    file and use that instead.
1...646566...392Latest