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

    Skye

    02/28/2023, 11:53 PM
    I'm guessing that's for --experimental-local
  • d

    dave

    02/28/2023, 11:53 PM
    Copy code
    yarn add -D @miniflare/tre@3.0.0-next.12
    Like this?
  • d

    dave

    02/28/2023, 11:53 PM
    yeah, I thought it would be a better idea to use this instead of miniflare?
  • s

    Skye

    02/28/2023, 11:54 PM
    I don't use yarn but that looks right
  • s

    Skye

    02/28/2023, 11:54 PM
    Experimental local uses workerd - miniflare 3 is just the adaptor between wrangler and workerd
  • d

    draco2003

    03/01/2023, 12:27 AM
    Anyone else experiencing issues with request.cf being undefined?
  • k

    kian

    03/01/2023, 12:28 AM
    In a Service Binding or just a normal inbound request?
  • d

    draco2003

    03/01/2023, 12:29 AM
    Copy code
    export default {
      async fetch(request, env) {
        if (request) {
          console.log(request.cf);
          return new Response("Hello cf");
        } else {
          return new Response("Hello world");
        }
      }
    }
  • d

    draco2003

    03/01/2023, 12:29 AM
    workers.dev
  • d

    draco2003

    03/01/2023, 12:29 AM
    normal inbound request
  • k

    kian

    03/01/2023, 12:30 AM
    In the Quick Edit preview of the dashboard or actually deployed?
  • d

    draco2003

    03/01/2023, 12:31 AM
    looks like if deployed it works, but preview it's undefined?
  • k

    kian

    03/01/2023, 12:32 AM
    Yeah
  • k

    kian

    03/01/2023, 12:32 AM
    It won't exist in preview since the preview isn't quite a 'real' Worker
  • k

    kian

    03/01/2023, 12:32 AM
    I'd always recommend publishing it or using
    wrangler dev
    locally for a proper preview environment
  • d

    draco2003

    03/01/2023, 12:32 AM
    gotcha, could have swarn it was there yesterday, but might have been looking at this code to long 🙂
  • d

    draco2003

    03/01/2023, 12:33 AM
    definitely using wrangler dev and local tests, etc.. Went to go make sure the bundle looked good in the "quick edit" and saw a ton of errors and it boiled down to .cf being undefined. Looks like it is a none issue if it only happens in the Preview tool.
  • d

    draco2003

    03/01/2023, 12:39 AM
    Appreciate the quick responses and the sanity check for me.
  • d

    dave

    03/01/2023, 1:22 AM
    Is there something like this, but for Cloudflare Workers? https://stoplight.io/open-source/prism
  • s

    Saumya Majumder

    03/01/2023, 9:47 AM
    Hi, does anyone here know how to make calls to external APIs using
    fetch()
    that requests user to provide authentication details? Something like
    curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]
    I couldn't find any way to do this. Is there any library that can be used for this?
  • k

    kian

    03/01/2023, 10:04 AM
    Just an Authorization header
  • k

    kian

    03/01/2023, 10:04 AM
    Copy code
    js
    export default {
      fetch(req) {
        const username = "user";
        const password = "passwd";
        const b64 = btoa(`${username}:${password}`);
    
        return fetch("https://httpbin.org/basic-auth/user/passwd", {
          headers: {
            Authorization: `Basic ${b64}`,
          },
        });
      },
    };
  • s

    Saumya Majumder

    03/01/2023, 10:47 AM
    Thank you so much @kian
  • p

    Panthy

    03/01/2023, 11:47 AM
    I remember that I read that workers where charged for the duration that it proxied a websocket on the unbound plan. has it changed or does that still stand?
  • n

    nittolinho

    03/01/2023, 12:55 PM
    Hi everyone! I was wondering if it would be possible to insert lighthouse-ci on a cloudflare worker to get performance data closest to the user. I have found https://github.com/GoogleChrome/lighthouse-ci/issues/873 , but I think I am missing something. Does anybody know if it is possible to achieve smth like this?
  • z

    zegevlier

    03/01/2023, 12:57 PM
    That seems to need headless chrome. You can't run that on workers. However, there is something called the rendering API that might also offer this when it comes out.
  • z

    zegevlier

    03/01/2023, 12:58 PM
    https://blog.cloudflare.com/introducing-workers-browser-rendering-api/
  • n

    nittolinho

    03/01/2023, 1:02 PM
    Cool! Will join waitlist, thanks
  • g

    GuillaumeLakano

    03/01/2023, 3:46 PM
    Hi! We are on a paid plan for workers since 2020, and I'm trying for the 1st time to change in my wrangler.toml the usage_model to "unbound", but I got this error: « workers.api.error.wrong_plan [code: 10075] » Do I have to enable something to uses it ?
  • c

    cdslash

    03/01/2023, 3:58 PM
    I've been trying to do the same thing - have applied for the rendering waitlist so hopefully it doesn't take too long to get into the beta.
1...231323142315...2509Latest