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

Improve webhook testing with new dev tools #845

Closed
JulianBissekkou opened this issue Jan 21, 2021 · 4 comments
Closed

Improve webhook testing with new dev tools #845

JulianBissekkou opened this issue Jan 21, 2021 · 4 comments
Assignees

Comments

@JulianBissekkou
Copy link

🚀 Feature

An easy way to trigger fake webhook events for testing webhook endpoints!

Have you spent some time to check if this issue has been raised before?

Yes, doesn't look like there is another issue like this.

Have you read the Code of Conduct?

Yes 👍🏼

Pitch

I was working with stripe for a while now (https://stripe.com/) and they have a great SDK for client and server.
They also have a CLI which can be used for testing webhook events.

For example:
I wanted to create a webhook event if a customer did a specific action.
The stripe CLI allows me to create a fake event and then I am able to send that to my webhook endpoint.

stripe listen --forward-to http:https://localhost:8080/myEndpoint
stripe trigger name_of_event

We don't need a CLI for appwrite, but maybe some tooling to make webhook testing a little easier.
Maybe you can share some thoughts on this ☺️

@eldadfux
Copy link
Member

I really like this feature. I think it will improve onboarding and dev experience.

I can think of two options to get this done:

  1. Add a trigger endpoint which will be available as a button on the UI, with the option to trigger any system supported event with mock data (can be auto-generated from our Models objects).
  2. Expose the webhooks API completely just as any other Appwrite API and allow to use the new endpoint from API, UI and upcoming Appwrite CLI.

Second option will force us to move all the webhooks data objects from the console DB to the project specific DB. The endpoint will only be accessible on server integration with an API key and new custom scopes.

@JulianBissekkou
Copy link
Author

I think the second option would be better for future features such as the CLI.
Another use case: I can create a unit test on my server that checks that my webhook endpoint works as expected with the appwrite server.
The test would create a webhook, executes a mocked event, and removed the webhook after the test is done.

If I upgrade appwrite to a newer version, I can just run the tests and make sure that everything works with the new appwrite version 👍

I did a similar thing with our stripe webhooks and it was quite handy after we migrated to the next major version of the stripe sdk.

@eldadfux
Copy link
Member

@JulianBissekkou sounds solid.

You can also use something like request catcher for testing webhooks, we use it for the Appwrite server tests. https://github.com/appwrite/docker-requestcatcher we use our own image for ARM support.

@JulianBissekkou
Copy link
Author

Oh That's nice!

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

No branches or pull requests

3 participants