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

    ! ThaUnknown_

    04/25/2022, 11:30 PM
    I implemented opengraph previews on my haven apps!
  • u

    ! ThaUnknown_

    04/25/2022, 11:30 PM
    https://haven.pages.dev/img-viewer/public/?file=https://cdn.discordapp.com/emojis/493353113332219924.gif&
  • u

    ! ThaUnknown_

    04/25/2022, 11:31 PM
    in haven you can specify external files in the url using searchParams, using CF functions and HTMLRewriter to then embed the url in an opengraph tag
  • u

    ! ThaUnknown_

    04/25/2022, 11:31 PM
    https://haven.pages.dev/video-player/public?file=https://img-9gag-fun.9cache.com/photo/aE8XqOe_460sv.mp4&
  • u

    ! ThaUnknown_

    04/25/2022, 11:31 PM
    cool stuff!
  • a

    Ayelet

    04/26/2022, 8:24 AM
    Hello, I'm new here, nice to e-meet everybody đź‘‹ ! I'm running my function with "wrangler pages" (different from the workers wrangler apparently), but I need to serve it with https rather than http. I saw that the regular (workers) wrangler has an option "local-protocol" to specify exactly that, but trying this option with wrangler pages gives the following error:
    Copy code
    > npx wrangler pages dev --local-protocol "https" -- npm run dev 
    
    Unknown arguments: local-protocol, localProtocol
    Any idea how to make my function run on https? Thanks!
  • g

    Greg Brimble | Cloudflare Pages

    04/26/2022, 10:44 AM
    Not currently possible, unfortunately. But we'll probably add this in the future.
  • j

    JustinNoel

    04/26/2022, 11:13 AM
    I use environment variables for my "secrets". The only risk is that someone can see them in my dashboard. However, since I'm the only user on my account, it's good enough for me. I am looking forward to real secrets support.
  • h

    hakan_

    04/26/2022, 12:00 PM
    Does functions replace SSR? What is it excatly?
  • o

    orstavik77

    04/26/2022, 12:06 PM
    I am not sure if you are thinking about some specific type of SSR, but you can do server-side rendering in your functions. Basically, functions are server-side scripts, similar to php pages. But in Javascript.
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 12:29 PM
    Yeah. Every Function is like a PHP endpoint (but no PHP, Javascript only). Some frameworks do indeed support SSR on Functions (SvelteKit and Remix and Nuxt are the main ones, with a few others) but that's not the only thing Functions do, just one of them.
  • h

    hakan_

    04/26/2022, 12:48 PM
    ok but like how can I use it?
  • h

    hakan_

    04/26/2022, 12:48 PM
    it will be similar like workers?
  • h

    hakan_

    04/26/2022, 12:48 PM
    or do I code that functions locally whats its about
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 12:49 PM
    Functions are similar to Workers, yes.
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 12:49 PM
    Except that they run on Pages and have a file-based routing system.
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 12:49 PM
    https://developers.cloudflare.com/pages/platform/functions/
  • h

    hakan_

    04/26/2022, 12:50 PM
    wow okay. but this remove like the ability to use stuff like webpack and dependencies?
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 12:51 PM
    For now, yes.
  • h

    hakan_

    04/26/2022, 12:51 PM
    hm okay. i will take a look at it
  • h

    hakan_

    04/26/2022, 12:51 PM
    whats a typical use case of functions
  • h

    hakan_

    04/26/2022, 12:51 PM
    not do able with workers
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 12:58 PM
    Well. Functions have a file-based routing system but it's not really a case of "what can't I do with Workers that I can do with Functions" it's more like "why should I use Functions."
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 12:59 PM
    I'd refer you to this: https://canary.discord.com/channels/595317990191398933/910978223968518144/955658277973291038
  • h

    hakan_

    04/26/2022, 1:10 PM
    interesting, so its similar like to an ssr backend. which frameworks it supports all?
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 1:10 PM
    It only supports SvelteKit, Remix, and Nuxt for SSR at the moment.
  • h

    hakan_

    04/26/2022, 1:10 PM
    ah okay cool
  • w

    warflash

    04/26/2022, 1:28 PM
    I'm pretty sure nuxt does not support pages ssr out of the box yet. Did some digging after they hit rc status recently and nitro (the server engine) only has worker support so far . Maybe theres an diy way to get it to work (which I'd love to try) but I don't think its natively supported yet unfortunately
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 1:33 PM
    I've seen someone running Nuxt on SSR...
  • i

    Isaac McFadyen | YYZ01

    04/26/2022, 1:33 PM
    The new one, I mean. V3 or whatever.
1...127128129...392Latest