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

    James

    05/19/2023, 12:14 AM
    Check out https://github.com/cloudflare/wrangler-action - that'll probably give you everything you need 🙂
  • b

    boywithkeyboard

    05/19/2023, 12:26 AM
    what do you think would be the best way to implement versioning in an api hosted on workers? - route-based, e.g.
    /api/v3/...
    - header-based, e.g. the
    accept-language
    header with the version as value () or a custom header
  • u

    Up

    05/19/2023, 12:29 AM
    perfect, thank you ^^
  • i

    Isaac McFadyen | YYZ01

    05/19/2023, 12:34 AM
    Paths. Versions in the path are standardized, and so you'll get the broadest support across things that you might decide to do someday (OpenAPI, Swagger, etc).
  • i

    Isaac McFadyen | YYZ01

    05/19/2023, 12:35 AM
    It also allows for easier caching based on the version - i.e. with the header approach you'd need to add custom cache rules to make sure version 2's cache doesn't get served for version 1, but with path-based that's built-in by default.
  • d

    dave

    05/19/2023, 1:59 AM
    please please don't do header routing
  • d

    dave

    05/19/2023, 2:00 AM
    we just implemented header based routing because we had to to retain compatibility with AWS' API, and it's so ugly.
  • d

    dave

    05/19/2023, 2:01 AM
    You won't be able to use OpenAPI schemas properly in many tools with header routing
  • j

    jjxtra

    05/19/2023, 2:30 AM
    @penalosa it was unbounded. But previous workers were not. Not sure what changed. I wasn’t able to change my default away from unbounded anywhere in the ui. Only paying the five dollars fixed it.
  • k

    kazu0617

    05/19/2023, 6:49 AM
    Hello. I’m trying to invite account for some other users, but how to set invite as editing for Workers Only? I set
    Cloudflare Workers Admin
    as new account, but it can check audit log also.
  • s

    style

    05/19/2023, 8:07 AM
    https://developers.cloudflare.com/workers/platform/limits/#worker-limits I'm curious whether CPU-intensive unbound workers from tenants will affect each other
  • h

    HardAtWork

    05/19/2023, 8:09 AM
    They should not, no.
  • s

    siri

    05/19/2023, 8:28 AM
    hello everyone, i am getting below error while executing my worker, any idea why ? Error: TypeError: _crypto.default.createHmac is not a function at worker.js:9100:43
  • s

    sdan

    05/19/2023, 8:29 AM
    is analytics engine free?
  • d

    Dani Foldi

    05/19/2023, 8:30 AM
    It is free during the beta, but eventually it will be paid. I'd expect the pricing to be announced in #981314061268578304
  • s

    sdan

    05/19/2023, 8:30 AM
    got it! also any docs on querying with graphql examples? i am having trouble interfacing with it via graphql -- regular sql queries over http work fine
  • s

    sdan

    05/19/2023, 8:32 AM
    i am logging users in the analytics engine but will be hard to analyze without some dashboard besides this

    https://cdn.discordapp.com/attachments/779390076219686943/1109035765528268850/Screenshot_2023-05-19_at_1.31.40_AM.pngâ–¾

  • d

    Dani Foldi

    05/19/2023, 8:32 AM
    Hi, no need to post in multiple channels, answering in #846453104382836766
  • d

    Dani Foldi

    05/19/2023, 8:33 AM
    I believe the only docs of AE graphql is this right now https://developers.cloudflare.com/analytics/analytics-engine/get-started/#4-query-data-using-graphql-and-sql-api, but as the site says more stuff should be added soon
  • s

    style

    05/19/2023, 8:34 AM
    How? Workers run on different process?
  • l

    Linka

    05/19/2023, 10:09 AM
    There are some issues with the Cron trigger of my Workers. It should trigger every five minutes, but now it triggers twice every five minutes, doubling my request count. Has anyone experienced a similar situation?

    https://cdn.discordapp.com/attachments/779390076219686943/1109060234804211802/image.pngâ–¾

  • n

    Neiki

    05/19/2023, 10:11 AM
    yeah have the same issue https://discord.com/channels/595317990191398933/1108689633295999007
  • d

    D3VL_Jack

    05/19/2023, 10:26 AM
    + 1 to double cron triggering
  • u

    Unsmart | Tech debt

    05/19/2023, 12:58 PM
    We have seen an uptick in these reports and put up an escalation for them. They will look into it
  • b

    BenParr

    05/19/2023, 12:59 PM
    Hey everyone, having a hard time finding much online with jest and workers. So I need to mock all of the types for fetch, request, response etc? Is there any docs on this
  • l

    Licoricevntrs

    05/19/2023, 1:24 PM
    Hello everyone, I'm trying to restrict access to an API I build with Workers that I want to use in page. When I try to send a request to the API with the authorization from Postman or any other tool, it works perfectly, but from my Pages code, I get a CORS error. I tried many things, but no one seems to works. Here's the code of my endpoint: `export default { async fetch(request, env, ctx) { const { pathname } = new URL(request.url); const authHeader = request.headers.get('authorization'); const apiKey = env.authorization; if (authHeader !==
    ${apiKey}
    ) { return new Response('Error accessing this page', { status: 401 }); } else (pathname.startsWith("/id/")) { const id = pathname.substring("/id/".length); const { results } = await env.DB.prepare("SELECT * FROM products WHERE id= ?").bind(id).all(); return new Response(JSON.stringify(results), { headers: { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, OPTIONS", "Access-Control-Allow-Headers": "authorization, Content-Type", "Access-Control-Allow-Credentials": "true" } }); } ...` And here's my call: `useEffect(() => { var myHeaders = new Headers(); myHeaders.append("authorization", "mykey"); var requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' }; fetch(
    myendpoint.com/id/${id}
    , requestOptions) .then(response => response.json()) .then(data => { if (data.length > 0) { setArticle(data[0]); } }) .catch(error => setError(error)); }, [id]);`
  • t

    tanushree

    05/19/2023, 1:50 PM
    @Linka @Neiki and/or @D3VL_Jack mind sharing your account ID (DM me) so that we can dig into logs?
  • d

    D3VL_Jack

    05/19/2023, 1:56 PM
    DM'd
  • s

    sathoro

    05/19/2023, 2:24 PM
    You need to properly respond to the OPTIONS preflight request
  • l

    Licoricevntrs

    05/19/2023, 2:35 PM
    Thank you @sathoro for your answer. How I could do this 😅 ?
1...248024812482...2509Latest