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

    Doryan

    11/23/2022, 4:21 AM
    Maybe I'm misunderstanding the documentation, but shouldn't
    Copy code
    wrangler pages dev / --port 5000 --proxy 5500
    run the server on port 5000 and serve the static pages located in the root folder on port 5500
  • s

    Skye

    11/23/2022, 7:40 AM
    The proxy command is for if you're fetching assets from a different dev server, it'll fetch them from that port
  • s

    Skye

    11/23/2022, 7:40 AM
    If you're just serving static assets, you should not specify the proxy argument
  • d

    Dave P

    11/23/2022, 7:32 PM
    It’s my understanding that we can’t use CF Functions with NextJS — static or Edge Runtime. Is that correct?
  • k

    kian

    11/23/2022, 7:32 PM
    Static as in exporting static files wouldn't have any dependency on Functions - as for Edge Runtime, take a look at
  • d

    Dave P

    11/23/2022, 7:37 PM
    Ok, thanks!
  • k

    Kedas

    11/24/2022, 6:45 AM
    is it possible to define a worker cron job alongside a set of functions?
  • k

    Kedas

    11/24/2022, 6:46 AM
    or at least within a _worker.js file w/o functions?
  • p

    Probert

    11/24/2022, 11:15 AM
    Did I read somewhere correctly that function logs don't work yet on direct uploads?
  • s

    Skye

    11/24/2022, 11:25 AM
    They should be working fine now
  • s

    Skye

    11/24/2022, 11:25 AM
    Just need to make sure your wrangler version is relatively new
  • p

    Probert

    11/24/2022, 11:28 AM
    Ah will update! Does the wrangler version also influence whether logs are visible in the dash?
  • s

    Skye

    11/24/2022, 11:36 AM
    the issue was that older wrangler versions didn't correctly upload something to the api - so the functions tab of the deployment wouldn't know there were any functions
  • s

    Skye

    11/24/2022, 11:36 AM
    meaning it also can't show you the logs in the dash
  • s

    Skye

    11/24/2022, 11:37 AM
    however the wrangler command for tailing pages deployments should work regardless
  • p

    Probert

    11/24/2022, 11:38 AM
    Makes sense, thanks for the info. Will update! EDIT: It works, woohoo!
  • j

    JustinNoel

    11/24/2022, 1:34 PM
    Maybe also try from the command line:
    Copy code
    wrangler pages deployment tail
    wrangler pages deployment tail https://....SOME_SPECIFIC_DEPLOYMENT_URL
  • p

    Probert

    11/24/2022, 1:36 PM
    Yes, this works for me now 🙂 I got confused initially because I tried to use it and it didn't work, but turns out the deploy was broken
  • r

    rodbs

    11/24/2022, 11:44 PM
    When I configure a normal function/[[path]].ts
    Copy code
    const handleRequest = createPagesFunctionHandler({
        build
      });
      
      export function onRequest(context) {
        return handleRequest(context);
      }
    I'm getting this error
    Copy code
    [pages:err] TypeError: Cannot convert undefined or null to object
        at Function.entries (<anonymous>)
        at Object.createRoutes2 [as createRoutes] (C:\Users\trials\remix-pages\node_modules\@remix-run\server-runtime\dist\routes.js:17:17)
        at createRequestHandler$1 (C:\Users\trials\remix-pages\node_modules\@remix-run\server-runtime\dist\server.js:27:25)
        at createRequestHandler (C:\Users\trials\remix-pages\node_modules\@remix-run\cloudflare-pages\dist\esm\worker.js:26:23)
    Any ideas? thx
  • j

    James

    11/24/2022, 11:49 PM
    That looks more like a Remix issue with how they're doing
    createPagesFunctionHandler
    to me 🤔
  • d

    Dogs

    11/25/2022, 2:07 AM
    i was wondering if there is a way of having a function execute every so often?
  • d

    Dogs

    11/25/2022, 2:31 AM
    Also another question is there a reason cloudflare doesn't use node?
  • i

    Isaac McFadyen | YYZ01

    11/25/2022, 2:37 AM
    https://developers.cloudflare.com/workers/learning/how-workers-works/ TLDR: V8 is the same engine as Chrome, and compared to Node.JS it has a highly optimized startup (around 5ms compared to 100ms+ for Node), is lighter weight, and isolates each customer's Workers from each other more effectively than Node can
  • d

    Dogs

    11/25/2022, 2:40 AM
    interesting
  • a

    amancoder28

    11/25/2022, 4:29 AM
    I don't know why but service bindings in Cloudflare Pages Functions aren't working, the bindings are returning an empty object. are there issues in Cloudflare Pages Functions Service Bindings?
  • r

    rodbs

    11/25/2022, 9:06 AM
    What do you mean? a bug? My main issue is that I haven't found and 'official' example using Remix, CF Pages and functions (When you create a Remix project using CL Pages it doesn't create the functions folder). But this seems odd to me because it's like this basic repo should show how to use functions within Pages
  • h

    HardAtWork

    11/25/2022, 9:15 AM
    I think it is because you can’t really “use functions” with Remix. Remix uses functions for rendering, and the API, so if you write an API route in Remix, it will be compiled to Functions
  • h

    HardAtWork

    11/25/2022, 9:16 AM
    Basically, if you use a framework like that, don’t manually create your Functions. They might work, but they might bork everything…
  • r

    rodbs

    11/25/2022, 9:29 AM
    I don't understand. This example (without repo) it uses functions for authentication. I've tried it out, but I have the same error. But I guess it might work ... It's a bit confusing ... https://dev.to/fllstck/serverless-remix-sessions-with-cloudflare-pages-4lpo
  • h

    HardAtWork

    11/25/2022, 10:02 AM
    It looks like what they are doing is having you mess around with the Remix Functions connector, which should be fine.
1...311312313...392Latest