Skip to content

workos webhook list shows an empty URL column and breaks table layout for long Events values #133

@smorimoto

Description

@smorimoto

Summary

Running workos webhook list shows an empty URL column for webhook endpoints.

Also, when a webhook endpoint is subscribed to many events, the Events column joins all event names into a single cell. This can exceed the terminal width and make the table difficult to read.

Steps to reproduce

  1. Create a webhook endpoint that is subscribed to many events.
  2. Run workos webhook list.

Actual behaviour

  • The URL column is empty.
  • The Events column becomes very long, which makes the terminal table difficult to read.

Notes from local code inspection

In src/commands/webhook.ts, the list output reads ep.url:

const rows = result.data.map((ep) => [ep.id, ep.url, ep.events.join(, ), ep.created_at]);

However, the webhook endpoint create request body in src/lib/workos-client.ts sends endpoint_url:

body: { endpoint_url: endpointUrl, events },

workosRequest appears to return the response JSON as-is, without normalising endpoint_url to url:

return data as T;

So if the real API list response contains endpoint_url, the human-readable table would read undefined from ep.url, which matches the empty URL column.

The current unit test mock uses url, so it may not catch this mismatch:

const mockWebhook = {
  id: we_123,
  url: https://example.com/hook,
  events: ['dsync.user.created'],
  created_at: '2024-01-01T00:00:00Z',
  updated_at: '2024-01-01T00:00:00Z',
};

The emulator also appears to model webhook endpoints with url, so it may be hiding a difference from the real API response shape.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions