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

    syon

    03/28/2023, 8:42 PM
    https://developers.cloudflare.com/pages/platform/functions/api-reference/ This is probably the best page lmk if anyon has some 3rd party docs 🙂
  • r

    RuslanT

    03/29/2023, 8:15 AM
    is it possible to use secrets with pages/functions or is env vars the only option for now? (if i do a
    wrangler secrets put
    it creates a new worker with the same name as the pages project )
  • k

    kian

    03/29/2023, 8:16 AM
    When you add a variable in the dashboard, click the encrypt button
  • r

    RuslanT

    03/29/2023, 8:20 AM
    @kian thank you, any way to get the same functionality (encrypt) using wrangler (dashboard will do but just wondering)?
  • e

    Erisa | Support Engineer

    03/29/2023, 9:24 AM
    For pages, I dont believe its possible through wrangler currently
  • e

    Erisa | Support Engineer

    03/29/2023, 9:25 AM
    Just dash and API
  • m

    Michael-V

    03/29/2023, 12:35 PM
    Wow, no use of threads here, so topics rush out of sight quite fast..... no one has experience with sending an email from a html form with cloudflare pages?
  • w

    Walshy | Pages

    03/29/2023, 12:40 PM
    #1063191651796914276 is literally a forum channel
  • s

    silentdevnull

    03/29/2023, 5:14 PM
    I'm following the documentation on https://developers.cloudflare.com/pages/platform/functions/bindings/#environment-variables I can't get the value of the environment variable I put in through the dashbaord.
    Copy code
    export function onRequest(context) {
        let t = context.env.name_of_variable;
        
        return new Response("Hello, world! " + t);
    }
  • w

    Walshy | Pages

    03/29/2023, 5:15 PM
    Did you do a deployment after setting the env var?
  • s

    silentdevnull

    03/29/2023, 5:17 PM
    yes I set the env var last week and trying to get them this week. I have done more than 10 deployments since setting them.
  • w

    Walshy | Pages

    03/29/2023, 5:18 PM
    Are you definitely using the name provided?
  • s

    silentdevnull

    03/29/2023, 5:25 PM
    yes I can echo it in my build script and I'm using sed to replace the value in a configuration file. So I know that parts working.
  • w

    Walshy | Pages

    03/29/2023, 5:26 PM
    ok is the Function definitely running?
  • w

    Walshy | Pages

    03/29/2023, 5:27 PM
    What happens when you try to hit it?
  • s

    silentdevnull

    03/29/2023, 5:32 PM
  • s

    silentdevnull

    03/29/2023, 5:33 PM
    If I remove the code to try and get the value it will return hello world
  • w

    Walshy | Pages

    03/29/2023, 5:34 PM
    at least that proves it's running, what's your pages.dev?
  • s

    silentdevnull

    03/29/2023, 5:35 PM
    May I DM to you?
  • w

    Walshy | Pages

    03/29/2023, 5:35 PM
    yep
  • w

    Walshy | Pages

    03/29/2023, 5:40 PM
    you aren't doing
    context.env.<env>
  • w

    Walshy | Pages

    03/29/2023, 5:41 PM
    you're just doing
    let t = <env>
  • s

    silentdevnull

    03/29/2023, 5:44 PM
    odd some how it got deleted on my end. I'm redeploying now
  • s

    silentdevnull

    03/29/2023, 6:02 PM
    that did the trick. don't I feel dumb for that one. Thank you @Walshy | Pages
  • s

    silentdevnull

    03/29/2023, 6:02 PM
    Is there away for me to view the files that are published or not a user viewable item.
  • w

    Walshy | Pages

    03/29/2023, 6:03 PM
    Your git repo :p
  • w

    Walshy | Pages

    03/29/2023, 6:03 PM
    You can always bundle the function yourself to see it but it isn't much different from your just normal code. We just bundle it together and do the routing
  • s

    Skye

    03/29/2023, 6:23 PM
    Doesn't the dashboard always have a list of assets now?
  • w

    Walshy | Pages

    03/29/2023, 6:23 PM
    Yes but I think they wanted the actual content
  • s

    silentdevnull

    03/29/2023, 6:32 PM
    Yes in this case I was looking for content. I do want to say though the asset list is very nice and was super helpful on figuring how the copy of my functions folder to the write spot. So thank you everyone for adding that one.
1...365366367...392Latest