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

    Crazy Rabbit

    01/18/2023, 10:33 AM
    awesome thanks
  • c

    Crazy Rabbit

    01/18/2023, 10:46 AM
    I have renamed Github Repository while being linked with Pages. So is there a way to relink it?
  • c

    Crazy Rabbit

    01/18/2023, 10:46 AM
    or should I remove the page and recreate it
  • b

    bkyerv

    01/18/2023, 11:51 AM
    if I import a third party library in the function (e.g. zod), does
    zod
    get imported everytime a request is served using this function? or is it imported once when the funcion is deployed and used thereafter from some sort of memory/cache?
  • h

    HardAtWork

    01/18/2023, 11:52 AM
    In general, with Workers/Functions, nothing is really imported. When you build/deploy your Functions, it takes all of your code, and all of the code from
    zod
    that you call, and bundle it up into a single file, which means every bit of your script, and every dependency(treeshaken) is in memory at all times.
  • j

    JustinNoel

    01/18/2023, 12:30 PM
    Hmmm. I wonder if @Erwin has ever heard of this ๐Ÿค”?
  • z

    zegevlier

    01/18/2023, 12:40 PM
    He has 11 commits to the repo, so I assume so haha
  • i

    IanVS

    01/18/2023, 8:19 PM
    When I run
    wrangler pages dev
    , it seems that my environment variables are not being used from my project. What do I need to do to get access to those? Create a
    .env
    file?
  • i

    IanVS

    01/18/2023, 8:25 PM
    Ah, it's
    .dev.vars
  • s

    Steve French

    01/19/2023, 10:10 PM
    Hi everyone, if you're using functions, you may be interested in a new reverse proxy plugin we just launched. The Proxyflare plugin is running on https://proxyflare.works, which in turn is running on Pages ๐Ÿคฏ
  • s

    Stigin

    01/20/2023, 12:07 AM
    grey on grey ๐Ÿซ  Just pulling your leg - looks good otherwise. will need to have a play around
  • s

    Steve French

    01/20/2023, 4:25 AM
    haha, as opposed to orange?
  • c

    Crazy Rabbit

    01/20/2023, 9:05 AM
    I have now 1 static file in worker that needs to be served, so it would cut my expenses in half if I just move it to cloudflare pages.
  • c

    Crazy Rabbit

    01/20/2023, 9:06 AM
    So it is possible to use analytics_engine_datasets ?
  • c

    Crazy Rabbit

    01/20/2023, 9:11 AM
    There seems to be bindings for KV, DO, R2 and D1.
  • w

    William.

    01/20/2023, 9:21 AM
    Sup all, I have an angular SPA and for SEO reasons I want to edit meta tags based on browser GET path. For example : https://mypage.spa/test --> insert
    <title>test1</title>
    https://mypage.spa/test2 --> insert
    <title>test2</title>
    Obviously this has to be done before the HTML is sent to the client (SSR style), can functions do that for me ? Or should I find a way to do it using workers instead ? I'm currently reading the "Middleware" section of the Functions doc, it looks like this is what i'm looking for, can anyone just confirm ?
  • s

    Skye

    01/20/2023, 9:41 AM
    It was just added earlier this week to the API, and the UI should be coming soon
  • c

    Crazy Rabbit

    01/20/2023, 9:41 AM
    Awesome thanks
  • r

    Rui Saraiva

    01/20/2023, 9:44 AM
    Hey ๐Ÿ‘‹ I'm wondering if by simply changing an environment variable, will it be updated for the currently deployed functions or do I need to re-deploy function in order to have access to the new values?
  • s

    Skye

    01/20/2023, 9:44 AM
    You'll need to redeploy
  • r

    Rui Saraiva

    01/20/2023, 9:47 AM
    Thanks, I was trying to find this information in the documentation, did I miss it somewhere? If not, could be a good addition to the documentation. ๐Ÿ™‚
  • s

    Skye

    01/20/2023, 9:48 AM
    If you want a clarification in the docs you should make an issue on the repo for it ๐Ÿ™‚
  • r

    Rui Saraiva

    01/20/2023, 10:02 AM
    That sounds good. Issue created https://github.com/cloudflare/cloudflare-docs/issues/7333.
  • w

    William.

    01/20/2023, 12:37 PM
    Aight managed to do it, I had a problem with fetch which was triggering some kind of infinite loop (because fetching body would retrigger middleware) so I just added a custom char in the fetch and I if()'ed it out of existence
  • j

    JustinNoel

    01/20/2023, 3:36 PM
    @Steve French This is definitely an accessibility concern. I had though reading some of those usage suggestions. Maybe use the browser's inspector tools or Lighthouse to point out that color contrast issues.
    s
    s
    • 3
    • 15
  • s

    Steve French

    01/20/2023, 6:54 PM
    will do, thanks for letting me know @JustinNoel
  • t

    The Tank

    01/20/2023, 11:46 PM
    Hi guys, is this a channel where I'm allowed to ask for help, or is it just intended for reporting bugs?
  • k

    kian

    01/20/2023, 11:47 PM
    Both is fine
  • t

    The Tank

    01/20/2023, 11:47 PM
    Cool thanks.
  • t

    The Tank

    01/21/2023, 12:00 AM
    I'm new to the functions side of things, but have been messing around with workers with some success. I would like to test a D1 SQlite database locally on a NUXT site. I have the site & database hosted in cloudflare already, and seems to be working fine when hosted. But I would like to either proxy my local dev environment to the existing hosting database or run the database locally. To speed up development. I have a seeding SQL script I can run over and over again fine. What command should I use to host the NUXT site with functions and the D1 database binding? Currrently I"m hosting the NUXT site seperately in a code terminal, then opening up a second terminal and running this command on the same root folder. 'wrangler pages dev ./functions --port 8788' I'm not sure if there is a way of doing it with one command in wrangler? I would like to access my database via context.env.database... locally. I tried this command, but didn't seem to have any luck with it: 'wrangler pages dev ./functions --port 8788 --d1=presentor --local --persist' Is that the right command? and if so, do I need to run the seeding again locally somehow to create the database? The error I'm seeing from postman is 'GET /api/venues: TypeError: Cannot read properties of undefined (reading 'prepare')' meaning the binding is not there at all...
1...336337338...392Latest