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

    kian

    03/17/2023, 4:57 PM
  • k

    Kot

    03/17/2023, 5:12 PM
  • k

    Kot

    03/17/2023, 5:13 PM
    thanks erisa!
  • i

    inesherminio

    03/17/2023, 5:21 PM
    Hey guys! I'm doing a post request on my worker to handle images upload to Cloudflare images.
    Copy code
    js
    router.post('/', async (req: Request, env: Env) => {
      const formData = await req.formData?.()
    // .....
    }
    I keep getting the following error
    TypeError: Parsing a Body as FormData requires a Content-Type header.
    , even though I am sending Content-Type header. Any ideas?
  • u

    U9G

    03/17/2023, 5:30 PM
    Is anyone else having problems with workers getting scanned?
  • u

    U9G

    03/17/2023, 5:31 PM
    I had the websocket open and I came back to probably 50 requests like this
  • u

    U9G

    03/17/2023, 5:31 PM
  • u

    U9G

    03/17/2023, 5:32 PM
  • u

    U9G

    03/17/2023, 5:32 PM
    and even some lookng for sensitive paths
  • u

    U9G

    03/17/2023, 5:32 PM
  • c

    Chaika

    03/17/2023, 5:36 PM
    It's because new workers get TLS certificates issued for them (wildcard on the worker name, i.e *.worker name.yourworkersubdomain.workers.dev, I think intended for when environments get added so you could have prod.workername...), and some bots just watch the certificate transparency (ct) logs and instantly scan
  • u

    U9G

    03/17/2023, 5:38 PM
    is there some prevention that can be done on cloudflares side?
  • c

    Chaika

    03/17/2023, 5:38 PM
    It's just an initial rush of traffic on new workers / renewals, and of course your worker isn't vulnerable to any of those so it doesn't really matter
  • c

    Chaika

    03/17/2023, 5:38 PM
    You could disable your workers.dev route, and use an http route or custom domain (note worker custom domains do also issue certificates unless you delete the ones they create). On your own domain the default WAF rulesets (Pro or higher) or even just some simple firewall rules would block most of those
  • c

    Chaika

    03/17/2023, 5:42 PM
    It's not really anything to be too worried about imo, usually it's just a few hundred requests max on new workers / renewal
  • d

    DJPaul

    03/17/2023, 5:55 PM
    On a Cloudflare Pages site (on a custom domain), I'm making an API request to a Worker (on a custom domain) via fetch(), with cache everything and cachettl set. The response object has some Cloudflare headers on it - cf-priority, cf-ray, server - but no
    CF-Cache-Status
    . I was expecting to see that to verify if the request was cached or not. What have I missed, please?
    w
    • 2
    • 5
  • r

    Ryan The Temp

    03/17/2023, 6:02 PM
    can workers establish websocket connections to external websocket servers?
  • e

    Erisa | Support Engineer

    03/17/2023, 6:27 PM
    Yes: https://developers.cloudflare.com/workers/learning/using-websockets/#writing-a-websocket-client
  • p

    Paper

    03/17/2023, 7:23 PM
    what version of node should i use with workers
  • j

    James

    03/17/2023, 7:25 PM
    For local dev with
    wrangler
    ? The latest 16 or 18 would probably be your best bet
  • c

    cake

    03/17/2023, 9:20 PM
    If I want to decrypt a file that was uploaded to a cloudflare worker, what crypto libraries are available in Cloudflare Workers? Are workers just a nodejs environment?
  • j

    James

    03/17/2023, 9:22 PM
    They're not nodejs, no - they're similar in that they both use V8, but it's not natively node and you won't have access to Node's
    crypto
    for example.
  • j

    James

    03/17/2023, 9:22 PM
    Workers support the Web Crypto APIs however: https://developers.cloudflare.com/workers/runtime-apis/web-crypto/
  • c

    cake

    03/17/2023, 9:37 PM
    What is the cost of web crypto? Are there any other alternatives? decryption for RSA seems limited
  • j

    James

    03/17/2023, 9:39 PM
    There's no additional cost, outside of the CPU time limits. Within bundled (50ms CPU), you might not be able to do much and it might require you to use the Unbound pricing model instead
  • j

    James

    03/17/2023, 9:40 PM
    As for alternatives, I'm sure someone has written RSA libraries in pure JS that could work. https://github.com/travist/jsencrypt for example. I've not used it so I couldn't speak to the security or implementation, and it's likely to be slower than a more native solution
  • r

    rd

    03/18/2023, 12:14 AM
    why would i get EADDRINUSE doing wrangler publish ? Never had this happen before
  • c

    Cyb3r-Jok3

    03/18/2023, 12:17 AM
    This typically means there is another wrangler running somewhere using the same port
  • b

    BearT

    03/18/2023, 12:17 AM
    can I use dotenv with cloudflare workers?
  • r

    rd

    03/18/2023, 12:17 AM
    yeah but how? Im using vscode terminal, not running wrangler dev either
1...234523462347...2509Latest