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

    Crazy Rabbit

    02/15/2023, 6:20 PM
    Linkedom supports import
  • v

    Vonarian

    02/15/2023, 6:20 PM
    Thanks!
  • c

    Crazy Rabbit

    02/15/2023, 6:20 PM
    https://webreflection.medium.com/linkedom-a-jsdom-alternative-53dd8f699311
  • c

    Crazy Rabbit

    02/15/2023, 6:20 PM
    It also seems to be a lot faster
  • d

    dave

    02/15/2023, 8:37 PM
    Random shot in the dark, anyone have a library like this but for Cloudflare Workers? https://github.com/devinstewart/sns-payload-validator/blob/main/lib/index.js
  • d

    dave

    02/15/2023, 8:39 PM
    actually better question, how should I go about making a PR that maintains nodejs compatibility, while adding CF Worker support? cc @kian since I assume you know. 😛
  • d

    dave

    02/15/2023, 8:41 PM
    yay ChatGPT linking me to fake non-existent libraries lol
  • d

    dave

    02/15/2023, 9:41 PM
    oh wait, nodejs supports web crypto now eh
  • a

    aaronsean

    02/15/2023, 10:48 PM
    Whats the usual turnaround time for a reply from Trust and Safety Team? (Workers team sent our ticket to them) but haven't got any update in 4 days.
  • d

    dave

    02/15/2023, 11:35 PM
    With Hono, is there a way to define the username/password using env variables instead of hardcoding like this?
    Copy code
    typescript
    import { Hono } from 'hono'
    import { basicAuth } from 'hono/basic-auth'
    const app = new Hono<{ Bindings: Env }>()
    
    app.get('/auth/page', basicAuth({ username: 'hono', password: 'acoolproject' }), (c) => {
        return c.text('Page test')
    })
  • u

    Unsmart | Tech debt

    02/15/2023, 11:36 PM
    I'd assume you do
    (c) => basicAuth({ username: c.env.username, password: c.env.password })(c)
  • u

    Unsmart | Tech debt

    02/15/2023, 11:36 PM
    or something similar
  • d

    dave

    02/15/2023, 11:37 PM
    like this?
    Copy code
    typescript
    app.get('/test', (c) => basicAuth({ username: c.env.username, password: c.env.password })(c), (c) => {
        return c.text('Page test2')
    })
  • u

    Unsmart | Tech debt

    02/15/2023, 11:37 PM
    yeah
  • d

    dave

    02/15/2023, 11:38 PM
    Copy code
    types.d.ts(11, 145): An argument for 'next' was not provided.
  • u

    Unsmart | Tech debt

    02/15/2023, 11:39 PM
    im guessing theres more params than just "c" so (c, ...params) in both spots
  • d

    dave

    02/15/2023, 11:40 PM
    this?
    Copy code
    typescript
    app.get('/test', (c, ...params) => basicAuth({ username: c.env.USER, password: c.env.PASS }), (c, ..params) => {
        return c.text('Page test2')
    })
  • u

    Unsmart | Tech debt

    02/15/2023, 11:40 PM
    yeah
  • d

    dave

    02/15/2023, 11:41 PM
    Copy code
    No overload matches this call.
      The last overload gave the following error.
        Argument of type '(c: Context<string, { Bindings: Env; }, unknown>, next: Next) => MiddlewareHandler<string, Environment, any>' is not assignable to parameter of type 'Handler<string, { Bindings: Env; }, unknown>'.
          Type 'MiddlewareHandler<string, Environment, any>' is not assignable to type 'Response | Promise<void | Response | undefined>'.
  • d

    dave

    02/15/2023, 11:41 PM
    hang on lemme read this a bit more first. https://honojs.dev/docs/api/middleware/#custom-middleware
  • u

    Unsmart | Tech debt

    02/15/2023, 11:41 PM
    or no it shouldve been this
    Copy code
    ts
    app.get('/test', (c, ...params) => basicAuth({ username: c.env.username, password: c.env.password })(c, ...params), (c) => {
        return c.text('Page test2')
    })
  • d

    dave

    02/15/2023, 11:43 PM
    hero, thank you! I would not have guessed that.
  • d

    dave

    02/15/2023, 11:48 PM
    oh
  • d

    dave

    02/15/2023, 11:48 PM
    https://github.com/honojs/hono/blob/main/docs/MIGRATION.md#basic-auth-middleware-and-bearer-auth-middleware
  • d

    dave

    02/15/2023, 11:49 PM
    derp
  • d

    dave

    02/15/2023, 11:57 PM
    real stupid question, can I have
    workers_dev = true
    create publicly reachable
    *.workers.dev
    target while doing
    wrangler dev
    ?
  • d

    dave

    02/15/2023, 11:58 PM
    just wondering how I can speed up my testing workflow
  • c

    Cyb3r-Jok3

    02/16/2023, 12:01 AM
    I'm pretty sure when you use
    wrangler dev
    it uses the *.workers.dev route for your worker
  • d

    dave

    02/16/2023, 12:02 AM
    Even if I haven’t published anything?
  • k

    Katze

    02/16/2023, 1:06 AM
    May I ask why people store stuff in the env instead of just hardcoding it?
1...227622772278...2509Latest