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

    Murder Chicken

    05/21/2023, 5:26 PM
    Any easy way to inspect the Request object created? Suddenly, this block of code (where
    requests
    is an array of Request objects)...
    Copy code
    const responseData = await Promise.all(requests.map(request => fetch(request).then(r => r.json())))
    ... no longer works resulting in this error...
    Copy code
    Cannot read properties of undefined (reading 'map')
    TypeError: Cannot read properties of undefined (reading 'forEach')
    Which has me baffled... trying to figure out where it's failing.
  • s

    Skye

    05/21/2023, 5:27 PM
    Could you share more code?
  • m

    Murder Chicken

    05/21/2023, 5:28 PM
    Yeah, just realized it's incomplete, one sec.
  • m

    Murder Chicken

    05/21/2023, 5:34 PM
    Copy code
    export async function example() {
      const endpoints = generateEndpoints() // returns a simple array of string URLs to fetch
      let requests = endpoints.map(endpoint => new Request(endpoint, { headers: { cookie } }))
      let responses = await Promise.all(requests.map(request => fetch(request).then(r => r.json())))
      let data = responses.map(response => processResponse(response['records']))
      let records = data.flat(3)
      records.forEach(a => {
        // Failure is this forEach
      })
    }
  • m

    Murder Chicken

    05/21/2023, 5:36 PM
    I think I got it.
  • m

    Murder Chicken

    05/21/2023, 5:37 PM
    Looks like the response changed and I failed to check for a data structure update in the response.
  • m

    Murder Chicken

    05/21/2023, 5:38 PM
    I'm good! Thanks for responding so quickly @Skye (as always)
  • s

    Skye

    05/21/2023, 5:38 PM
    Glad to help, even if I didn't see this until you worked it out 😅
  • m

    Murder Chicken

    05/21/2023, 5:40 PM
    hahaha, all good. I have to comment on how much I appreciate that you're always immediately responding to questions. Learning the platform can be difficult at times but you're constantly out there answering questions and assisting. It's really helpful.
  • s

    Skye

    05/21/2023, 5:50 PM
  • m

    Murder Chicken

    05/21/2023, 6:28 PM
    Is it possible to trigger a worker
    scheduledEvent
    from a development environment similar to the
    --test-scheduled
    flag and hitting the
    __scheduled
    route locally?
  • j

    James

    05/21/2023, 6:36 PM
    In dev, miniflare used to support hitting
    /cdn-cgi/mf/scheduled
    but I don't believe that's a thing anymore with v3 unfortunately.
  • d

    Dani Foldi

    05/21/2023, 6:38 PM
    it'll be reimplemented in v3 soon
  • m

    Murder Chicken

    05/21/2023, 7:02 PM
    locally in v3, it works fine, just add the
    --test-scheduled
    flag and hit the
    __scheduled
    route at the root of the domain. but once it's pushed to a development environment in CF, you have to wait for the event to trigger so I was hoping we could somehow trigger it manually.
  • s

    stan

    05/21/2023, 8:06 PM
    with the new TCP connections thing, i'm wondering if it would make sense to keep a postgres connection alive in a durable object as to not have to spin a new one for every worker run?
  • s

    stan

    05/21/2023, 8:07 PM
    i havent worked with DOs before but this kinda seems like something it would be good for
  • j

    James

    05/21/2023, 8:07 PM
    Yep that would make a lot of sense to me
  • s

    silence

    05/21/2023, 10:49 PM
    is there a way to make a pages site use unbounded usage model in local dev eg
    npx wrangler pages dev...
    if it was a workers function i would put
    usage_model="unbound"
    in my wrangler.toml
  • t

    tobytraylor

    05/22/2023, 12:38 AM
    hey all, new to cloudflare, building a solidjs app, i'm trying to fiture out how to run locally with miniflare or otherwise against the production data (KV, etc). Instead of running againts local data. been searching, can't figure out how.
  • i

    idv

    05/22/2023, 3:51 AM
    i made my website anti ddos i added a lot of rules is there a way i can copy the cloudflare rules onto another website of mine?
  • w

    wj

    05/22/2023, 3:55 AM
    Hi folks, I bought a domain name from cloudflare this month, and use pages to host my web site, it's awseome! I'm now learning how to use WASM as serverless solution, and found that cloudflare supports Wasm now: https://developers.cloudflare.com/workers/platform/web-assembly/ Just out of curiosity, does any one what's the different of the Wasm solution between fastly and CF? I mean, it would be better to describe the difference in high level, I wanna to to convince my boss to use one of it: https://www.fastly.com/blog/unlocking-real-time-at-the-edge
  • m

    Matt

    05/22/2023, 5:01 AM
    Is bunnynet a good tool to use if I want to test global latency into my cloudflare workers?
  • a

    Alaanor

    05/22/2023, 9:02 AM
    Is it now possible to have logpush enable for page's worker ?
  • i

    Isaac McFadyen | YYZ01

    05/22/2023, 11:55 AM
    Please don't cross-post across channels.
  • m

    MmaZik

    05/22/2023, 12:26 PM
    Hi guys, I'm developing 2 workers for the same project/account, in a Service Binding fashion. When deployed, the workers A is successfully able to call B. But locally, the Service Binding is actually
    undefined
    . Anyone can help? I have no idea why it can't see each other when running locally. This is my env during dev, for Workers A (caller):
    Copy code
    [env.dev]
    vars = { ENVIRONMENT = "dev", ENV = "dev" }
    services = [
      { binding = "SERVICES", service = "workers-services", environment = "dev" }
    ]
    And this is for Workers B (being called):
    Copy code
    [env.dev]
    name = "workers-services"
    vars = { ENVIRONMENT = "dev", ENV = "dev" }
    When I run with
    --remote
    (using Wrangler v3.0.0), I get this error: **text: 'workers.api.error.service_binding_env_error: could not resolve binding "SERVICES": environment "dev" not found for service "workers-services" [code: 10144]'** These are however separate project, one is Bundled (A) and one is Unbound (B). One is nodejs compat (B), one is not (A).
  • m

    MmaZik

    05/22/2023, 12:28 PM
    When running with
    --remote
    , it spits out the error message just a short time after starting. When running locally (which is the default since wrangler v3.0.0 I assume), the
    env.SERVICE
    is undefined. Running live, no problem.
  • b

    banbanboi

    05/22/2023, 1:34 PM
    i am just new with this and learning, I just want to ask, if is it possible to call a CF Worker that will generate a presignedURL (upload to CF R2). The file that I am going to upload will come to a web UI fileupload.
  • s

    sathoro

    05/22/2023, 2:34 PM
    pretty sure there are example of this exact scenario in the R2 docs right?
  • b

    banbanboi

    05/22/2023, 2:45 PM
    I am still reading the documentation and at the same time creating a worker base code for this.
  • b

    BenParr

    05/22/2023, 2:59 PM
    I am trying to add a secret to cf worker via ci/cd. Can I set it after using wrangler secret put. I dont want to have to add in an echo in powershell as this could be a security issue. How can I set secrets via cli?
1...248624872488...2509Latest