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

    Skye

    01/12/2023, 2:43 PM
    5173 is vite's port - you'll need to visit the one wrangler opens instead
  • s

    Skye

    01/12/2023, 2:49 PM
    Visiting the correct port logs "Hello world!" each time I click the button
  • y

    Yudai Nakata

    01/12/2023, 2:49 PM
    I know, kian has told me that. Do I have to
    fetch
    the wrangler's host and set up CORS on the client side, which is unnecessary in production? That doesn't sound very practical...
  • s

    Skye

    01/12/2023, 2:50 PM
    Not sure why you'd need any of that? Seems to be functioning fine
  • s

    Skye

    01/12/2023, 2:50 PM
  • y

    Yudai Nakata

    01/12/2023, 2:55 PM
    Ah didn't notice visiting :8788 leads to the app, thanks! how stupid of me 🤦
  • y

    Yudai Nakata

    01/12/2023, 2:56 PM
    I thought that port was only for functions.
  • s

    Skye

    01/12/2023, 2:57 PM
    Wrangler will take that port, serve your functions, and anything that isn't a function gets proxied to the port of the command that it ran, in this case it ran
    vite
    , so it proxies 5173
  • s

    Skye

    01/12/2023, 2:57 PM
    Meaning you never have to visit vite's one directly
  • y

    Yudai Nakata

    01/12/2023, 3:03 PM
    Got it. Maybe can it be documented at https://developers.cloudflare.com/pages/platform/functions/local-development/ if I'm not the only one who makes this silly mistake?
  • s

    Skye

    01/12/2023, 3:04 PM
    I've not personally seen anyone have this - but if you'd like it to be documented, making an issue on the docs repo is the best way 🙂
  • d

    dave

    01/12/2023, 6:10 PM
    @Erisa | Support Engineer sorry stupid question, can I store the port number in a config file somewhere?
    Copy code
    wrangler pages dev --proxy 57985 -- vite
  • s

    Skye

    01/12/2023, 6:12 PM
    Unfortunately not currently
  • s

    Skye

    01/12/2023, 6:12 PM
    I'd recommend you take advantage of the package.json scripts for this, so you can have a shortcut like "npm run dev"
  • d

    dave

    01/12/2023, 6:14 PM
    ty for confirming, that's what I was bout to do
  • c

    Crazy Rabbit

    01/12/2023, 8:54 PM
    "Writing your Functions files in this directory will automatically generate a Worker with custom functionality at predesignated routes" What if the route is dynamic like: https://domain.com/creator/ {username} /
  • c

    Crazy Rabbit

    01/12/2023, 8:56 PM
    Each user has their own main page. That needs to be generated.
  • c

    Crazy Rabbit

    01/12/2023, 8:59 PM
    Found it
  • w

    Walshy | Pages

    01/12/2023, 9:02 PM
    /functions/creator/[username].ts
  • c

    Crazy Rabbit

    01/12/2023, 9:02 PM
    Functions are a life saver.
  • e

    Erisa | Support Engineer

    01/12/2023, 9:14 PM
    Functions are pretty great
  • c

    Crazy Rabbit

    01/12/2023, 9:39 PM
    Is there any way to get error like with workers?
  • c

    Crazy Rabbit

    01/12/2023, 9:39 PM
    error logs or something
  • w

    Walshy | Pages

    01/12/2023, 9:45 PM
    yep you can tail just like Workers: * Dash: * Wrangler:
    wrangler pages deployment tail
  • c

    Crazy Rabbit

    01/12/2023, 9:46 PM
    thanks
  • h

    helpme

    01/13/2023, 12:15 AM
    Hello, am i able to run my pages function on every url route ?
  • w

    Walshy | Pages

    01/13/2023, 12:16 AM
    funtions/[[path]].js
    runs on all paths 🙂
  • h

    helpme

    01/13/2023, 12:16 AM
    amazing!!
  • h

    helpme

    01/13/2023, 12:16 AM
    is that in the documentation somewhere ?
  • w

    Walshy | Pages

    01/13/2023, 12:17 AM
1...331332333...392Latest