https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • z

    zelnaut

    03/15/2023, 2:44 PM
    Oh, my bad. Great, thanks!
  • j

    JatinGundabathula

    03/15/2023, 3:01 PM
    Hey Guys, Is there any api or a service exposed externally to update the Environment Variables runtime for workers ?
  • z

    zszszsz

    03/15/2023, 8:02 PM
    Switch to bound and all will be free 🙂
  • v

    Vero 🐙

    03/15/2023, 8:09 PM
    Hey yall, the tech writing team is doing its first user research survey on the @User docs. I would greatly appreciate if you could: 1. Participate and tell me everything you need out more from developers.cloudflare.com/workers 2. Please retweet so we can have maximum participation ❤️ https://twitter.com/CloudflareDev/status/1636087413381406722?s=20
  • l

    Leo

    03/15/2023, 8:10 PM
    link without twitter tracker:
  • r

    Ryan The Temp

    03/16/2023, 1:33 AM
    Hi, i went through the chat tutorial for using websockets with workers. Everything seems to work great locally using
    npx wrangler dev
    but when I publish the worker, all the requests show in the log as
    Cancelled
    when I try to connect a client using websocket. How come it works on local but not when published?
  • r

    Ryan The Temp

    03/16/2023, 1:34 AM
    and gotchas there?
  • r

    Ryan The Temp

    03/16/2023, 1:34 AM
    (still learning this, btw)
  • s

    SK

    03/16/2023, 2:38 AM
    are there mechanisms in place to prevent workers from fanning out requests to themselves? My worker behaves correctly when I limit the initial fan out to 1, but as soon as I let it grow it stops working. The logs just say "cancelled" and my third party logs aren't being executed
  • s

    SK

    03/16/2023, 2:38 AM
    (I'm using service bindings to call the same worker but different routes)
  • s

    SK

    03/16/2023, 2:39 AM
    all the logic is in waitUntil and it usually executes in < 1s anyway, not reaching anywhere near the 30s cap
  • s

    Srd

    03/16/2023, 5:07 AM
    FYI https://twitter.com/mjackson/status/1636228919081959424?s=20
  • p

    Plotzes

    03/16/2023, 6:35 AM
    omg it's micheal jackson hehe shamony
  • s

    SC_pRo_ION

    03/16/2023, 7:42 AM
    Good day, colleagues! I have a question regarding Cloudflare workers' performance. In our infrastructure, we want to use workers as a workaround when our API is inaccessible for some reason. The worker tries to handle requests and puts them into a queue to resend to the working API when it will be recovered. The problem is with the consumer worker. The only job it does is it takes a request from the queue and sends it to our API (using fetch). It gives a maximum of 5 RPS per consumer even when I don't even
    await
    the fetch result. Has anybody here faced the same problem? Is it possible to speed up consumer performance? Now I only see the solution in adding multiple queues and multiple consumers which is way too difficult to handle and it still doesn't give enough RPS.
  • m

    m0c

    03/16/2023, 8:27 AM
    Hey, I am runnign api proxies on cf workers. And I need to support grpc. My proxy does some stuff like authentication, authorization, load balancing retries, caching etc.. but generally just sendint the same request to different backend servers. One of the APIs we would need to support is gRPC. But when sending a gRPC request to my worker, i cant even log the http request. Has anyone managed to proxy or accept grpc requests?
  • t

    TL&D

    03/16/2023, 8:34 AM
    Can't I request a server that doesn't use tls1.3 when I use worker subrequest?
  • j

    JatinGundabathula

    03/16/2023, 10:16 AM
    Hi Guys, Is there any api to create/update the bindings (Ex: Environment) for worker. I found one for
    GET
    https://api.cloudflare.com/client/v4/accounts//workers/services//environments//bindings
  • j

    Jasper

    03/16/2023, 3:36 PM
    Hey all 👋 I have a question: I'm currently trying to get hold of the potential costs of workers a month since we have over 125 million requests a month (we're currently testing Workers on just a few endpoints). The analytics currently show for 514k requests the past 24h that does go through the worker: a duration of 1.51k GB-sec and a median CPU time of 0.5ms. It will be around 8 million requests a day that should be processed through the workers. The average request response size is about 3kB. Would be helpful if anyone has some tips how to calculate this the best. I've found certain topics already and the pricing details in the docs, but get lost what the GB-sec does if the traffic is high. I think we will need to move to the unbound version, but I'm unsure about the rest 🙂
  • k

    kian

    03/16/2023, 3:39 PM
    Bundled pricing is just per request pricing, so if 50ms of CPU time per request works for you then you can stick with Bundled
  • p

    PatrickJ

    03/16/2023, 3:45 PM
    How are you guys deploying workers? Would love to have preview and production environment with github integration
  • j

    Jasper

    03/16/2023, 3:47 PM
    Yeah that would be fine I think (is that the median CPU time I should look at?). So for 125 million requests, that would be around $62,5, without thinking about all the things around it?
  • z

    zegevlier

    03/16/2023, 4:55 PM
    You should look at the max one to be sure, but if you median is 0.5 I doubt it'll be much higher. If your duration (not CPU time, wall clock time) is under about 225ms, unbounded can be slightly cheaper. But, if you want to be more sure about how much you're going to be charged, use bundled.
  • z

    zegevlier

    03/16/2023, 4:55 PM
    Especially if you're connecting to APIs or anything like that
  • j

    Jasper

    03/16/2023, 6:56 PM
    Thanks for the info! We'll slowly move to Workers and see how the stats will look like at the end of the month. Then we can see if the unbounded would be cheaper or not 😄
  • r

    Ryan The Temp

    03/17/2023, 4:27 PM
    Hi, is it possible to establish a websocket connection from worker to another worker? I built a POC where a worker does:
    Copy code
    ts
    const socket = new WebSocket(env.OTHER_WORKER)
    socket.addEventListener('error', (event) => {
      console.error('error', event)
    })
    socket.addEventListener('open', () => {
      socket.send('hello world ')
    
      socket.addEventListener('message', (event) => {
        console.log('from other worker socket', event.data)
       })
    })
    This works on local, but it doesn't work when I publish it. Is there a reason why it doesn't work in prod?
  • d

    Dawn Parzych

    03/17/2023, 4:39 PM
    I am looking for cool examples of using Workers to do things with objects in an R2 bucket. Will potentially turn them into a blog. Are you using a Worker to do ETL operations on an object? Serve a custom 404 if an object isn't found? Would love to hear what you're doing and bonus points if you have code that can be shared.
  • e

    Erisa | Support Engineer

    03/17/2023, 4:43 PM
    > Serve a custom 404 if an object isn't found? That functionality, as well as directory listing and serving an index file for a folder, are available as part of https://github.com/kotx/render, a project by @Kot which I contributed quite a bit to prior to joining CF. The original aim was to implement public buckets before those existed, then nowadays it is extended and can be used as a library for existing Workers that need to serve files with extra functionality, and for adding the functionality that Public buckets do not have available to them.
  • k

    kian

    03/17/2023, 4:47 PM
    I used Workers to migrate from S3 to R2 - by migrating them from S3 if they wasn’t found in R2 & storing them in R2 whilst returning the file from S3 to the user. You could likely hook it up to AWS’s event systems to pull it from S3 as it’s added to S3, but I’d personally just start uploading new objects straight to R2.
  • k

    kian

    03/17/2023, 4:47 PM
    Jacob had some cool uses with Queues & R2 to batch writes to save on operations costs
  • k

    kian

    03/17/2023, 4:57 PM
    You could probably use R2 as a permacache for Image Resizing variants to save a lot on costs
1...234423452346...2509Latest