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

    wonkrattle

    12/03/2021, 3:20 AM
    No I get that, it’s a New product after all
  • e

    Epailes

    12/03/2021, 12:00 PM
    Not sure if this is the right channel for it, but I'm building a creator platform using nextjs. Primarily with SSR and planning to use cf caching as a way to use ISR but with more control. If you're looking for beta testers for full stack pages using nextjs, I'm actively developing on mine at the moment and would love to help get support for this built faster. Project isn't live yet so downtime etc isn't an issue, won't be live for a couple of months at best. Project is currently running on vercel with cf in front.
  • g

    geelen

    12/03/2021, 1:09 PM
    Ah I think our first NextJS SSR support will be using their new middleware syntax and React Server Components only, sadly
  • g

    geelen

    12/03/2021, 1:10 PM
    Their traditional SSR is very heavily tied to NodeJS and ExpressJS, neither of which run well on Workers
  • g

    geelen

    12/03/2021, 1:12 PM
    I genuinely don't know how easy it's going to be for folks to port to middleware/RSC yet, need to spend some time with it
  • s

    Skye

    12/03/2021, 1:25 PM
    This is different to the newer version of nuxt, yes? Would that perhaps be a possibility sometime soon
  • g

    geelen

    12/03/2021, 1:32 PM
    new Nuxt should be much easier, they've already done all the hard work
  • g

    geelen

    12/03/2021, 1:33 PM
    to be fair, NextJS's support of React Server Components looks like it can replace all the old uses of NextJS SSR, I'm glad Vercel's put effort in there
  • s

    Skye

    12/03/2021, 1:33 PM
    oh excellent, I look forward to it
  • g

    geelen

    12/03/2021, 1:33 PM
    So pretty soon we should have some pretty nifty framework support for Full Stack Pages
  • s

    Skye

    12/03/2021, 1:34 PM
    if y'all ever need a tester for nuxt, I'm more than glad to 😛
  • e

    Epailes

    12/03/2021, 4:35 PM
    Ah interesting I wasn't aware of that! I've not looked into RSC much, I'm assuming it should still be possible to control whether those are cached? Either way, I'm early days so it's easier for me to change these now rather than in 6/12 months time, so if you're looking for guinea pigs happy to help!
  • j

    jacobmarble

    12/03/2021, 6:02 PM
    I just got
    wrangler pages dev
    working. It is a little unclear how the
    /functions
    directory is discovered. Appears to be simply
    $PWD/functions
    , is that correct?
  • g

    Greg Brimble | Cloudflare Pages

    12/03/2021, 6:02 PM
    It should be the root of the project, yes. (Not the build output directory)
  • j

    jacobmarble

    12/03/2021, 6:04 PM
    Ah, the root of the project relative to what definition of the project?
    package.json
    ?
  • g

    Greg Brimble | Cloudflare Pages

    12/03/2021, 6:05 PM
    In prod, it'll be the root of the git project.
  • g

    Greg Brimble | Cloudflare Pages

    12/03/2021, 6:05 PM
    wrangler pages dev is just doing
    ./functions
    , under the assumption it's being run from the root of the git project.
  • j

    jacobmarble

    12/03/2021, 6:06 PM
    Excellent, so
    $PWD/functions
    was my way of saying the same thing, I believe.
  • g

    Greg Brimble | Cloudflare Pages

    12/03/2021, 6:07 PM
    If you've got a project that's structured differently, I'd love to hear about it in an issue on GitHub. We could maybe be more clever with finding that functions directory. I'm sure we can navigate to the nearest git root and find it relative to that instead.
  • j

    jacobmarble

    12/03/2021, 6:12 PM
    It's more of a documentation issue.
    wrangler pages dev
    explicitly asks for the location of static assets (the same requirement exists in prod; I get it) and explicitly states that the script path defaults to
    _worker.js
    but does not state where (or if) it will look for
    /functions
    .
  • j

    jacobmarble

    12/03/2021, 6:12 PM
    In fact, if I run
    npx wrangler@beta pages dev ./public --script-path ./doesnotexist
    then
    /functions
    still works. Maybe
    --script-path
    should inform the discovery of
    /functions
    and default to
    /functions
    ?
  • j

    jacobmarble

    12/03/2021, 6:13 PM
    (I say all of this to suggest improvements; the Pages product is amazing, by the way)
  • g

    Greg Brimble | Cloudflare Pages

    12/03/2021, 6:27 PM
    Thanks for the feedback!
    --script-path
    exists for people who are using the proxy command thing. We'd still need to know where the
    _worker.js
    file is, so this is an escape hatch for that, essentially.
  • g

    Greg Brimble | Cloudflare Pages

    12/03/2021, 6:28 PM
    We'll work on making sure that's clearer 🙂
  • j

    jacobmarble

    12/03/2021, 10:38 PM
    I have successfully used
    wrangler pages dev
    to fix a problem on my side. Now the site succeeds with
    wrangler pages dev
    , but the preview deployment continues to fail with
    Failed: an internal error occurred
    . What's my next step?
  • j

    jacobmarble

    12/03/2021, 10:39 PM
    TBF, I'm trying to use the
    square
    npm module, which requires nodejs shims. If I knew more about the error, I could decide whether it's worth switching payment processor to Stripe.
  • j

    jacobmarble

    12/03/2021, 11:19 PM
    The
    square
    npm module depends on
    apimatic/core
    for its
    HttpClient
    , which depends on
    axios
    , which isn't switching to the Fetch API any time soon. My guess is that is causing this "internal error" in the Pages deployment.
  • j

    jacobmarble

    12/03/2021, 11:21 PM
    If someone wouldn't mind confirming that
    axios
    is a dealbreaker for Cloudflare Pages/Workers, then I'll open an issue with Square.
  • j

    James

    12/03/2021, 11:30 PM
    axios
    definitely won't work on Workers. You'll need something that uses
    fetch
    under the hood.
  • j

    jacobmarble

    12/03/2021, 11:30 PM
    Thanks
1...293031...392Latest