hookdeck / hookdeck-vercel

Authenticate, delay, filter, queue, throttle, and retry asynchronous HTTP requests (e.g., webhooks) made to a Vercel application via a middleware integration with Hookdeck
Apache License 2.0
30 stars 1 forks source link

Make source name more prominent if middleware connection creation / update output for use in local development #9

Open leggetter opened 5 months ago

leggetter commented 5 months ago

The present output is something like the following, which is very verbose:

Connection updated {
  id: 'web_385vBCWBo7t3',
  team_id: 'tm_rWCCtze3Vbfa',
  updated_at: '2024-04-26T20:21:59.631Z',
  created_at: '2024-04-26T20:06:52.778Z',
  paused_at: null,
  name: null,
  rules: [ { type: 'retry', count: 5, interval: 60000, strategy: 'linear' } ],
  description: 'Autogenerated from Vercel integration',
  destination: {
    id: 'des_ESrYcUgTMSDv',
    team_id: 'tm_rWCCtze3Vbfa',
    url: 'https://hookdeck-vercel-example.vercel.app',
    updated_at: '2024-04-26T20:15:41.596Z',
    created_at: '2024-04-26T20:06:52.573Z',
    rate_limit: 10,
    rate_limit_period: 'minute',
    cli_path: null,
    path_forwarding_disabled: false,
    name: 'api-webhooks',
    http_method: null,
    auth_method: { type: 'HOOKDECK_SIGNATURE', config: {} },
    description: 'Autogenerated from Vercel integration',
    disabled_at: null
  },
  source: {
    id: 'src_y2xmnguyeneemb',
    team_id: 'tm_rWCCtze3Vbfa',
    updated_at: '2024-04-26T20:06:52.562Z',
    created_at: '2024-04-26T20:06:52.575Z',
    name: 'vercel-527074e1c',
    allowed_http_methods: [ 'POST', 'PUT', 'PATCH', 'DELETE' ],
    custom_response: null,
    description: 'Autogenerated from Vercel integration',
    url: 'https://hkdk.events/y2xmnguyeneemb',
    disabled_at: null,
    verification: null
  },
  disabled_at: null,
  full_name: 'vercel-527074e1c -> api-webhooks'
}
Destination updated {
  id: 'des_ESrYcUgTMSDv',
  team_id: 'tm_rWCCtze3Vbfa',
  url: 'https://hookdeck-vercel-example.vercel.app',
  updated_at: '2024-04-26T20:21:59.951Z',
  created_at: '2024-04-26T20:06:52.573Z',
  rate_limit: 10,
  rate_limit_period: 'minute',
  cli_path: null,
  path_forwarding_disabled: false,
  name: 'api-webhooks',
  http_method: null,
  auth_method: { type: 'HOOKDECK_SIGNATURE', config: {} },
  description: 'Autogenerated from Vercel integration',
  disabled_at: null
}
Hookdeck connection configured successfully https://hkdk.events/y2xmnguyeneemb
Hookdeck successfully configured

> hookdeck-vercel-example@0.1.0 dev
> next dev

✔ Console Ninja extension is connected to Next.js, see https://tinyurl.com/2vt8jxzw
  ▲ Next.js 14.2.3
  - Local:        http://localhost:3000
  - Environments: .env.local

 ✓ Starting...
 ✓ Ready in 1614ms
 ✓ Compiled /src/middleware in 237ms (565 modules)

The Hookdeck URL is reasonably prominent:

Hookdeck connection configured successfully https://hkdk.events/y2xmnguyeneemb

However, for local development you really want to know the generated source name to connect the Hookdeck CLI to which is buried in the middle of the output.

Suggest: reduce the output and only show in verbose mode. By default just show:

  1. The Hookdeck Source URL
  2. The Hookdeck Source name
alexbouchardd commented 5 months ago

In this case, though, you couldn't use that URL with the CLI. In general, the URL itself can't really be used without the middleware so it's unclear to me why we would even print it. What's the workflow you picture here?

leggetter commented 5 months ago

Maybe the URL isn't required. Just the source name so you know what to choose when you run hookdeck listen.

alexbouchardd commented 5 months ago

@jmnavarro This makes sense and aligned with our discussion in slack