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

    zszszsz

    04/17/2023, 10:56 PM
    I like that `new Socket({ type '' }) `part. It could be sth other than tcp or udp in future. Better than the old fashioned
    new TCPSocket()
    or
    new UDPSocket()
  • w

    Walshy | Pages

    04/17/2023, 11:01 PM
    it's
    connect(<address>)
  • j

    James

    04/17/2023, 11:03 PM
    yeah the API in that post is a bit dated now - https://github.com/cloudflare/workerd/blob/main/samples/tcp/gopher.js is probably the most up to date example
  • z

    zszszsz

    04/17/2023, 11:07 PM
    what about the udp world
  • j

    James

    04/17/2023, 11:08 PM
    I'm not sure that exists yet
  • w

    Walshy | Pages

    04/17/2023, 11:10 PM
    yeah we're focusing on outbound TCP right now
  • d

    dkfdkdodkms

    04/18/2023, 3:33 PM
    is it okay to put misc. supporting classes in the functions dir?
  • s

    Skye

    04/18/2023, 3:34 PM
    What do you mean by that?
  • d

    dkfdkdodkms

    04/18/2023, 3:35 PM
    i mean classes that are used by endpoints. Util.ts for instance
  • s

    Skye

    04/18/2023, 3:35 PM
    You can put whatever you want in there, it's all bundled up
  • z

    zszszsz

    04/18/2023, 6:03 PM
    It wont be considered an endpoint as long as it does not export onRequest
  • g

    Gradyent

    04/20/2023, 10:59 PM
    I have a directory structure like this:
    Copy code
    - packages/
      - web/
        - functions/
        - src/
        - package.json
        - webpack.config.js
      - workers/
    - package.json
    Where web/ is my Pages code. It seems like when I deploy this, the frontend Pages code in src/ works as expected, but the functions do not (calls to my one function return HTML). I'm guessing this is because functions/ isn't at the top level? Is there a way around this?
  • j

    James

    04/20/2023, 11:02 PM
    cd packages/web && wrangler pages publish src
    maybe?
  • j

    James

    04/20/2023, 11:02 PM
    The publish command needs to be run in the same directory as
    functions
    , so you could either move to it, or
    cp/mv
    the
    functions
    dir before publish
  • j

    James

    04/20/2023, 11:03 PM
    I know better monorepo support like this is planned in the future, but unless someone else has a better suggestion, that's probably the easiest solution 🙂
  • g

    Gradyent

    04/20/2023, 11:10 PM
    Thanks for the response, @James! I just tried using a symlink instead and that seems to work. I wanted to keep using the git integration rather than calling
    publish
    locally, and this lets me do that.
  • j

    James

    04/20/2023, 11:11 PM
    A symlink is a great solution! Glad you've got it working now 🙂
  • d

    d4rekanguok

    04/21/2023, 12:02 PM
    Hello! I'm trying to process a file upload with functions (file -> base64 -> sendgrid attachment) & it looks like I need to set a compatibility flag or date. However from a quick search in this channel it sounds like Functions doesn't read wrangler.toml.. is there any other way?
  • h

    HardAtWork

    04/21/2023, 12:03 PM
    You set flags/dates via the dashboard.
  • d

    d4rekanguok

    04/21/2023, 12:04 PM
    didn't know how I missed that — thank you @HardAtWork
  • p

    Plotzes

    04/21/2023, 5:49 PM
    is there a way to check in my code if im running with
    wrangler pages dev ...
    or if it's running in prod?
  • p

    Plotzes

    04/21/2023, 5:49 PM
    like some global variable or smt
  • s

    Skye

    04/21/2023, 5:49 PM
    globalThis.MINIFLARE
    will do
  • p

    Plotzes

    04/21/2023, 5:50 PM
    thanks!
  • l

    Larry

    04/23/2023, 5:32 PM
    Is it possible to use queues beta with
    wrangler pages dev
    locally?
  • z

    zszszsz

    04/23/2023, 5:49 PM
    Are queues already in public beta ?
  • j

    James

    04/23/2023, 5:51 PM
    Queues consumers aren't supported with Pages Functions today unfortunately
  • z

    zszszsz

    04/23/2023, 6:11 PM
    wrangler pages dev
    may make
    esbuild
    eating up CPU time if it has been running for hours, or is it only on my device ?
  • z

    zszszsz

    04/23/2023, 6:12 PM
    It is advanced mode, no proxy, no rebuilds, just resting, when
    esbuild
    is taking 15% CPU usage on my m1 macbook.
  • h

    HardAtWork

    04/23/2023, 6:45 PM
    Um, it might be stuck. Even for the biggest Workers I've ever built, I've never hit more than a second of build...
1...375376377...392Latest