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

    silence

    04/13/2023, 1:12 AM
    I didn't actually think of that. for some reason I was thinking I wanted it to run every so often to register them but that would be pointless since if i add a new one it requires a redeployment anyways... Thanks for giving me an obvious answer that some how eluded me lol
  • j

    JohnsCreek

    04/13/2023, 3:26 AM
    Hello everyone, the preview function for the Cloudflare App is not working on all Apps, is there any update on that?
  • j

    JohnsCreek

    04/13/2023, 3:28 AM
  • c

    Chaika

    04/13/2023, 3:30 AM
    Cloudflare Apps are pretty much abandoned/unmaintained at this point. Most of them are by third party devs as well, it might be that the ones you are using are broken This channel is for workers, if you want to talk about Apps more, please use #909458221419356210
  • j

    JohnsCreek

    04/13/2023, 3:31 AM
    Thanks!
  • d

    Dio

    04/13/2023, 3:48 AM
    guys are trying to use service binding. There are 2 worker A "user" and a "parser". I've written service binding in "parser "config. I run -local 2 worker . I try to get it via env.user, but I see there is no «user» in parser env, although at start it says that there is service binding in console
  • k

    Kent

    04/13/2023, 4:35 AM
    Hi, all , I saw event.cf.longitude is only available for Enterprise customers, so it means we 5$ paid plan users cannot access that? Thanks for your responding
  • k

    kian

    04/13/2023, 4:37 AM
    Where did you see that it's Enterprise only?
  • k

    Kent

    04/13/2023, 4:43 AM
    https://community.cloudflare.com/t/starting-with-workers-and-lat-long/217639
  • k

    Kent

    04/13/2023, 4:43 AM
    Keep in mind that the event.cf object and its properties, including event.cf.latitude, are only available to Cloudflare Enterprise customers in the scope of their workers running on the Cloudflare network.
  • k

    Kent

    04/13/2023, 4:44 AM
    In the first thread, the last user said that.
  • k

    Kent

    04/13/2023, 4:44 AM
    It is said by GPT4
  • k

    Kent

    04/13/2023, 4:45 AM
    { "outcome": "exception", "scriptName": "wapi", "exceptions": [ { "name": "TypeError", "message": "Cannot read properties of undefined (reading '0')", "timestamp": 1681312866750 } ], "logs": [ { "message": [ { "code": "404" } ], "level": "log", "timestamp": 1681312866750 } ], "eventTimestamp": 1681312865895, "event": { "request": { "url": "https://wapi.li2niu.com/v1?sign=REDACTED&provider=q&lang=8389372&api_key=&lat=-0.00&lon=0.00", "method": "GET", "headers": { "accept": "*/*", "accept-encoding": "gzip", "accept-language": "zh-CN,zh-Hans;q=0.9", "cache-control": "no-cache", "cf-connecting-ip": "114.92.92.54", "cf-ipcountry": "CN", "cf-ray": "7b6c7503c9724136", "cf-visitor": "{\"scheme\":\"https\"}", "connection": "Keep-Alive", "content-type": "application/x-www-form-urlencoded", "host": "wapi.li2niu.com", "user-agent": "ConnectMobile/4 CFNetwork/1404.0.5 Darwin/22.3.0", "x-forwarded-proto": "https", "x-real-ip": "114.92.92.54" }, "cf": { "clientTcpRtt": 242, "longitude": "121.45810", "latitude": "31.22220", "tlsCipher": "AEAD-AES128-GCM-SHA256", "continent": "AS", "asn": 4812, "clientAcceptEncoding": "gzip, deflate, br", This is a json from worker log. I saw the lat and lon in event.cf
  • k

    kian

    04/13/2023, 4:49 AM
    > It is said by GPT4 Ignore GPT-4 then
  • k

    kian

    04/13/2023, 4:50 AM
    It'll work fine regardless of plan
  • s

    sirhype

    04/13/2023, 4:54 AM
    By chance, does anyone have a sample Worker that has separate environments (staging/prod) with different endpoints and different environment variables for each? I want to setup a staging API for my Worker that deploys to staging.example.com/api/v1 and uses separate environment variables (beta DB)
  • k

    kian

    04/13/2023, 5:32 AM
    Copy code
    toml
    
    # Top-level configuration
    name = "my-worker"
    main = "src/index.js"
    compatibility_date = "2022-07-12"
    
    workers_dev = false
    route = { pattern = "example.org/*", zone_name = "example.org" }
    
    kv_namespaces = [
      { binding = "<MY_NAMESPACE>", id = "<KV_ID>" }
    ]
    
    [env.staging]
    name = "my-worker-staging"
    route = { pattern = "staging.example.org/*", zone_name = "example.org" }
    
    kv_namespaces = [
      { binding = "<MY_NAMESPACE>", id = "<STAGING_KV_ID>" }
    ]
  • k

    kian

    04/13/2023, 5:33 AM
    Just add it under a [env.foo] header
  • d

    Dio

    04/13/2023, 5:45 AM
    inside worker there is access to service binding, but not inside DO. How can this be solved? Workers work locally
  • j

    Jorge Murta

    04/13/2023, 8:13 AM
    How do you all organize different projects? As far as I know there is no concept of projects, and from what I can see if I really want to isolate different project I would need another cloudflare account, or is there a better way?
  • k

    kian

    04/13/2023, 8:15 AM
    The only concept that applies to Workers is accounts - so yeah, you could use other accounts but I wouldn't personally
  • k

    kian

    04/13/2023, 8:15 AM
    I also don't use enough Workers for organisation to be an issue so take that with a grain of salt
  • j

    Jorge Murta

    04/13/2023, 8:16 AM
    so you usually build different projects on the same cloudflare account? and if so, do you use any naming convention to keep them organized?
  • k

    kian

    04/13/2023, 8:22 AM
    Not particularly, I just rely on Git/Wrangler to manage all of my projects
  • g

    greyireland

    04/13/2023, 9:59 AM
    Hello everyone, I want to run my code on all worker nodes in all regions of cloudflare. How do I set this up?
  • k

    kian

    04/13/2023, 10:01 AM
    You don't - that's just how Workers work.
  • k

    kian

    04/13/2023, 10:01 AM
    When they receive a request, the Worker will be invoked in the colo that the user hit.
  • g

    greyireland

    04/13/2023, 10:03 AM
    If I want every deployment worker to execute my code, is there a way to do it? I deployed a cron trigger and found that it only fires my code on one worker
  • g

    greyireland

    04/13/2023, 10:04 AM
    Or does this worker have an initialization function, which can be executed once when I publish?
  • h

    HardAtWork

    04/13/2023, 10:04 AM
    Workers only spawn when processing a Request, and then they are evicted, so that wouldn't really do much
1...239123922393...2509Latest