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

    .4li

    03/12/2023, 7:18 PM
    I was checking Service Workers, it is mentioned in ES Modules. Thank you so much!
  • u

    .4li

    03/12/2023, 7:51 PM
    Is it possible to get amount of written bytes to the client in worker?
  • h

    HardAtWork

    03/12/2023, 7:56 PM
    In the Response body, maybe. For the entire Response, no, since some of the Response body is written in later stages that are not accessible to the Worker.
  • u

    .4li

    03/12/2023, 7:59 PM
    I'm trying to reverse proxy from bucket storage to client and I want to know how much bytes it is written to the client so I can deduct the fee from their balance. I assume the only way here would be to clone the response to bucketstorage first, read the content-length, inform the backend, and then return the response. The only risk is that maybe the connection dies on user's side in the middle of the download.
  • h

    HardAtWork

    03/12/2023, 8:12 PM
    If you are fetching directly from bucket storage, then you should be able to read the
    content-length
    without cloning the
    Response
  • u

    .4li

    03/12/2023, 8:17 PM
    Yeah good point!
  • a

    Advany

    03/13/2023, 12:21 PM
    I am trying to calculate if bundled or unbound is cheaper (to send a mail using MailChannels). I only do that in the worker call. I saw that its 0.178 GB-s duration. If I calculate it, it seems like bundled is still cheaper. Or am I doing the calculation wrong? I calculated based on that duration that 1M calls using unbound would be $2.37 while bundled would be $0.5
  • w

    Walshy | Pages

    03/13/2023, 12:30 PM
    unless you're doing like 10 mil+ requests all under 225ms, Bundled will be cheaper
  • a

    Advany

    03/13/2023, 12:36 PM
    yeah I told that to the client. Whats 225ms? is that the GB-s? that isnt a factor when doing bundled right
  • w

    Walshy | Pages

    03/13/2023, 12:36 PM
    225ms of either wall time or 8x CPU time
  • w

    Walshy | Pages

    03/13/2023, 12:36 PM
    and no, doesn't matter for Bundled, just unbound
  • a

    Advany

    03/13/2023, 12:39 PM
    is wall time GB-s or is that something different... because I count not find wall time in the cloudflare stats
  • w

    Walshy | Pages

    03/13/2023, 12:40 PM
    wall time just means like actual time, like if you look at a clock
  • w

    Walshy | Pages

    03/13/2023, 12:40 PM
    (which may be GB-s yes - assuming it's more than the multiplied CPU time)
  • a

    Advany

    03/13/2023, 12:40 PM
    aaah... awesome. I learned something new 🙂
  • w

    Walshy | Pages

    03/13/2023, 12:40 PM
    Unbound billing is sadly quite confusing
  • a

    Advany

    03/13/2023, 12:46 PM
    Switching our traffic from pointing to Vercel functions to Cloudflare workers in the next 8 weeks (for our own and clients)... 140 million requests a month... Vercel costs: $5600 Cloudflare costs: $70 First things are switched and its already 20% faster...
  • a

    Advany

    03/13/2023, 12:49 PM
    yeah, but its still great that its there for when needing longer processes
  • w

    Walshy | Pages

    03/13/2023, 12:50 PM
    Oh wow, that is quite the saving!
  • a

    Advany

    03/13/2023, 12:53 PM
    yeah... I was really skeptical about the pricing at first... looked like there was a catch somewhere... but then I understood that vercel is also build on top of cloudflare... they just add a margin on top 🙂
  • t

    theGagne

    03/13/2023, 2:29 PM
    Using CF Access I think it’s possible, but the docs for how to do it seem to have gone missing. https://blog.cloudflare.com/using-your-devices-as-the-key-to-your-apps/
  • s

    stavros-k

    03/13/2023, 6:10 PM
    How does one users a library like
    sequalize
    in a worker? I get all shorts of "cannot resolve" X package
  • b

    boywithkeyboard

    03/14/2023, 8:14 AM
    i want to implement some geolocation security based on the user's country/region? the country & region should be 99.99% of the time accurate compared to the city which might differ on every request, right?
  • b

    boywithkeyboard

    03/14/2023, 8:14 AM
    how accurate is the geolocation data to put it in other words?
  • b

    boywithkeyboard

    03/14/2023, 8:15 AM
    do you bundle your code?
  • k

    kian

    03/14/2023, 8:18 AM
    It's basically a giant user (or company) maintained database.
  • k

    kian

    03/14/2023, 8:18 AM
    There are inaccuracies every now & then.
  • b

    boywithkeyboard

    03/14/2023, 8:22 AM
    yeah but how accurate are the region and country field?
  • h

    HardAtWork

    03/14/2023, 8:23 AM
    It depends on the accuracy of the GeoIP data. It is generally correct for regular users, but server-bounded apps may use Anycast IPs, which may be wildly wrong.
  • h

    HardAtWork

    03/14/2023, 8:24 AM
    Check out https://www.maxmind.com for more info.
1...234023412342...2509Latest