Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect type for workos.webhooks.constructEvent #864

Open
benasher44 opened this issue Sep 15, 2023 · 2 comments
Open

Incorrect type for workos.webhooks.constructEvent #864

benasher44 opened this issue Sep 15, 2023 · 2 comments

Comments

@benasher44
Copy link

Previously, this would always return a Webhook (now Event), unless verifyHeader failed. Now, it returns undefined, if the payload couldn't be deserialized.

@benasher44
Copy link
Author

benasher44 commented Sep 15, 2023

Basically, now you can get here, which returns undefined.

@benasher44
Copy link
Author

I think there are 2 options:

  1. Update the type to be Event | undefined (and maybe everywhere else this is used?)
  2. Add a default case that throws

2 might be best, since it avoids a breaking change + people may already expect this to throw due to signature verification failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant