Skip to content

Cloudflare Worker cannot verify webhooks with SDK #1350

@stefandevo

Description

@stefandevo

Trying to use the

import { WorkOS } from '@workos-inc/node';

const workos = new WorkOS(process.env.WORKOS_API_KEY);

const webhook = await workos.webhooks.constructEvent({
  payload: payload,
  sigHeader: sigHeader,
  secret: process.env.WEBHOOK_SECRET,
});

Webhook processing error: SignatureVerificationException: Signature hash does not match the expected signature hash for payload

/@workos-inc[email protected]/node_modules/@workos-inc/node/lib/common/crypto/signature-provider.js:30:23)
at [object Object]
at fulfilled
(/@workos-inc[email protected]/node_modules/@workos-inc/node/lib/common/crypto/signature-provider.js:5:58)

Doing a manual check as describe here https://workos.com/docs/events/data-syncing/webhooks/3-process-the-events/b-validate-the-requests-manually DOES work.

So I guess it's an issue with the SDK and the crypto usage?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions