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

    Keenwau

    12/11/2021, 10:14 PM
    Im just confused because the blog post code sample looks all pretty and then the Stripe worker github repo has the nasty polyfill webpack config stuff.
  • s

    saibotsivad

    12/11/2021, 10:14 PM
    right, exactly, it doesn't make sense
  • k

    Keenwau

    12/11/2021, 10:14 PM
    It isnt really the end of the world just disapponting.
  • k

    Keenwau

    12/11/2021, 10:15 PM
    And these products are all evolving so Im sure its another
  • s

    saibotsivad

    12/11/2021, 10:15 PM
    sure, of course, and if I can get this Pages Functions thing working with a wonky Webpack build then that's "okay" with me
  • s

    saibotsivad

    12/11/2021, 10:22 PM
    this part from the blog post makes me think it's supposed to work out-of-the-box in Pages Functions > There’s no additional configuration needed — as we announced yesterday, Pages’ new Workers Functions features allows you to deploy infinitely-scalable functions just by adding a new functions folder to your project. but I can tell you, it's definitely not working for me
  • e

    Erwin

    12/12/2021, 3:33 AM
    I haven't had a chance yet to read that blog post, but if they have you include a webpack config that have to use to compile to make it work, that certainly isn't going to work for Pages Functions yet. I will suggest internally that we republish the output of that builds in a
    stripe-workers
    package. I am not sure if that has been suggested during their collaboration.
  • s

    saibotsivad

    12/12/2021, 4:24 AM
    the blog post suggests, as per the quote I copied over, that importing the
    stripe
    lib should work with "no additional configuration needed" in the "Pages' new Workers Functions"
  • e

    ethxn

    12/12/2021, 4:34 AM
    Hello, I'm just getting started with pages functions and trying to test them locally. I've run into an issue where I get
    TypeError: Web Socket request did not return status 101 Switching Protocols response with Web Socket
    when I run
    wrangler pages dev -- next dev
    .
  • e

    Erwin

    12/12/2021, 4:39 AM
    Oh I know it says that, but I am not sure that Kristian realised the limitations of Pages Functions when he wrote that. Because it certainly won't work. I have just asked internally if there were any plans to post multiple packages to npm. I'll let you know when I hear something back.
  • e

    Erwin

    12/12/2021, 4:40 AM
    In the meantime, you could build the output a standalone library from the repository and include that build file in your Pages repository.
  • s

    saibotsivad

    12/12/2021, 4:56 AM
    I ended up just ditching their SDK entirely and manually making fetch calls to their API (thankfully I only have a couple endpoints to hit so it's easy enough)
  • e

    Erwin

    12/12/2021, 5:16 AM
    I have done this many a time as well..
  • m

    maxbeyer

    12/12/2021, 11:56 AM
    Im also trying to just copy the functions that I need from twilio. But in the end I still need to generate a jwt. Twilio is using
    jsonwebtoken
    for that, but it seems that library too requires some node libraries
    Could not resolve "stream" (use "platform: 'node'" when building for node)
    . I dont necessarily need to use
    jsonwebtoken
    but i need to create a JWT for this to work. Is that possible without having to write my own jwt library?
  • e

    Erwin

    12/12/2021, 12:31 PM
    There are a couple of JWT libraries out there that support workers. But I keep forgetting what they are called. Doesn’t worktop have one?
  • o

    oliverjam

    12/12/2021, 1:54 PM
    Yeah Worktop does but only in the
    next
    branch. Don't think it's totally ready yet
  • p

    pxkq

    12/12/2021, 2:34 PM
    Seems like https://github.com/panva/jose could work for you
  • j

    Jeremiahlee

    12/12/2021, 2:55 PM
    Is this fixed in production yet?
  • m

    maxbeyer

    12/12/2021, 4:10 PM
    thank you very much for your help 👍
  • c

    Cоlе

    12/12/2021, 5:21 PM
    Has anyone else been having any problems with
    env
    today?
  • c

    Cоlе

    12/12/2021, 5:23 PM
    Last night on wrangler, I had to start using
    env.env
    for some reason, but when I pushed it, neither
    env
    nor
    env.env
    are working
  • c

    Cоlе

    12/12/2021, 5:23 PM
    I'd dig more, but at work atm
  • e

    ethxn

    12/12/2021, 10:20 PM
    Hello, I'm just getting started with pages functions and trying to test them locally. I've run into an issue where I get
    TypeError: Web Socket request did not return status 101 Switching Protocols response with Web Socket
    when I run
    wrangler pages dev -- next dev
    .
  • e

    Erwin

    12/12/2021, 10:34 PM
    I think the local dev server doesn’t do proxies yet.
  • e

    Erwin

    12/12/2021, 10:34 PM
    Can you post a code snippet so we can take a look?
  • e

    ethxn

    12/12/2021, 10:34 PM
    Oh? Strange that its in the documentation then
  • e

    ethxn

    12/12/2021, 10:35 PM
    Does this mean then I would have to build the site then serve the folder?
  • e

    Erwin

    12/12/2021, 10:39 PM
    I am not familiar with the exact state of the pages functions as it stands now. I will ask Greg or Glen to give a “State of the Functions” address when they wake up.
  • e

    ethxn

    12/12/2021, 10:40 PM
    Thanks, I appreciate it. If it is that the proxy isnt working could they also include a ETA on when it will be?
  • e

    Erwin

    12/12/2021, 10:45 PM
    ETA won’t be too easy to give, the number 1 priority for the entire team is currently on getting a big non-functions item over the line. But it is certainly one of the first things they want to get done on functions.
1...404142...392Latest