Skip to content

PORTAL_ENABLE_WEBHOOK_CUSTOM_HEADERS=true causes TypeScript SDK zod validation of the GET /destination-types response to fail #760

@dominicrathbone

Description

@dominicrathbone

Describe the bug
When PORTAL_ENABLE_WEBHOOK_CUSTOM_HEADERS is set to true, a new config field keyed custom_headers is added to the webhook destination type in the response to GET /api/v1/destination-types:

[{"type":"text","label":"Webhook URL","description":"The URL to send webhook events to via HTTP POST","key":"url","required":true,"pattern":"^https?:\\\\/\\\\/[^\\\\s]+$"},{"type":"key_value_map","label":"Custom Headers","description":"Additional HTTP headers to include with every webhook request","key":"custom_headers","required":false}]

This is causing a zod validation in the TypeScript SDK as it doesn't seem to recognise the key_value_map type:

[{"received":"key_value_map","code":"invalid_enum_value","options":["text","checkbox"],"path":[0,"config_fields",1,"type"],"message":"Invalid enum value. Expected 'text' | 'checkbox', received 'key_value_map'"}]

To Reproduce
Steps to reproduce the behavior:

  1. Set the PORTAL_ENABLE_WEBHOOK_CUSTOM_HEADERS environment variable to true
  2. Install typescript SDK package and run new Outpost({ ... })..schemas.listDestinationTypes()
  3. Zod validation error occurs

Expected behavior

The TypeScript SDK should recognise this enum value

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions