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

    dave

    05/01/2023, 6:53 AM
    Interesting. Thank you, we’ll do the same then I think. 🙂
  • d

    dave

    05/01/2023, 6:54 AM
    How do you set an user identifier in createDurable? Sorry, DOs are still the one thing my head struggles with.
  • s

    sathoro

    05/01/2023, 6:54 AM
    yeah just use the hash of the key as the object ID and add a user id field to the API key DO object. ez pz
  • s

    sathoro

    05/01/2023, 6:54 AM
    in the constructor you just do something like this.userId = null
  • s

    sathoro

    05/01/2023, 6:55 AM
    then you'd make a create method that assigns the userId and when you call persist() it saves it
  • s

    sathoro

    05/01/2023, 6:55 AM
    or with autoPersist it does it for you
  • d

    dave

    05/01/2023, 7:02 AM
    Could also add an alarm for the JWT expiry time. 🙂
  • d

    dave

    05/01/2023, 7:10 AM
    Counter.get('test').toJSON() // test is the ID here, right?
  • d

    dave

    05/01/2023, 7:10 AM
    https://github.com/kwhitley/itty-durable for context on what I’m reading
  • e

    embed

    05/01/2023, 7:20 AM
    Does anyone know S3 compatible client for Workers? I don't think I can use aws4fetch cause I am not using S3.
  • e

    embed

    05/01/2023, 7:20 AM
    I was trying to use the minio js client but that isn't compatible
  • s

    sathoro

    05/01/2023, 7:23 AM
    yeah that is correct
  • s

    sathoro

    05/01/2023, 7:24 AM
    the user might want to revoke before the expiration though which is set at 2 weeks
  • d

    dave

    05/01/2023, 7:24 AM
    we use aws4fetch with Lambda Function URLs just fine.
  • d

    dave

    05/01/2023, 7:24 AM
    Thank you so much, everything just clicked. 😁
  • e

    embed

    05/01/2023, 7:25 AM
    I am not using AWS at all, completely different service with an S3 compatible api
  • d

    dave

    05/01/2023, 7:26 AM
    Should still be fine. (Me/my company just implemented a AWS API for an upcoming service we’re launching, aws4fetch works fine for clients in our unit tests afaik.)
  • d

    dave

    05/01/2023, 7:33 AM
    We use aws4fetch with: - Backblaze B2 - IDrive E2 - Wasabi
  • e

    embed

    05/01/2023, 7:34 AM
    im trying to upload a file but it just uploads a 0 byte file.
  • e

    embed

    05/01/2023, 7:34 AM
    this not how i would go about doing that?
  • d

    dave

    05/01/2023, 7:35 AM
    Try signQuery = true
  • e

    embed

    05/01/2023, 7:36 AM
    now its not uploading anything at all
  • e

    embed

    05/01/2023, 8:05 AM
    i guess nevermind? this code just works now
  • e

    embed

    05/01/2023, 8:05 AM
    not sure what happened
  • e

    embed

    05/01/2023, 8:06 AM
    or i guess neermind? now it shows that the image is invalid
  • b

    BONAFIDE BOSS

    05/01/2023, 9:57 AM
    how to get the body of an email message?
  • w

    Wichard

    05/01/2023, 11:10 AM
    Do workers only run in the locations given here: https://www.cloudflare.com/network/ , or can they run in other edge locations?
  • h

    HardAtWork

    05/01/2023, 11:12 AM
    Workers run wherever your CF website runs. If you are on Free, you get fewer colos. Unless you have an ICP license, then your Workers will not run in China.
  • w

    Wichard

    05/01/2023, 11:17 AM
    I don't have a CF website. I only have a workers script. From the testing I have done, if I run my worker by sending it an HTTP request from a sever in Europe, it will run on a cloudflare datacenter in Europe (the closest one to where I made the request). If I make the HTTP request to a server in the US, it will run in a datacenter in the US. Correct?
  • h

    HardAtWork

    05/01/2023, 11:18 AM
    That's generally the idea. If you hit it from Australia, it might get routed to Hong Kong, but in general, a Request will stay within a "region"(Cloudflare doesn't really have much of a concept of regions, but this is just for illustrative purposes).
1...242824292430...2509Latest