Coder Social home page Coder Social logo

svix / svix-webhooks Goto Github PK

View Code? Open in Web Editor NEW
2.2K 22.0 153.0 7.51 MB

The enterprise-ready webhooks service πŸ¦€

Home Page: https://www.svix.com

License: MIT License

JavaScript 0.38% TypeScript 2.47% Python 4.05% Shell 0.33% Go 3.19% Ruby 1.76% PHP 0.77% Java 4.14% C# 9.88% Kotlin 3.26% Dockerfile 0.23% Rust 67.99% Jinja 1.49% HTML 0.04%
webhooks rust webhook-server webhook-service webhook webhooks-server webhook-dispatcher webhook-ingester api background-jobs

svix-webhooks's People

Contributors

arjunyel avatar dependabot[bot] avatar fcjr avatar jaymell avatar jterry avatar ksindi avatar maful avatar plarsson avatar rkuprov avatar rolznz avatar sokratisvidros avatar svix-aaron1011 avatar svix-andor avatar svix-daniel avatar svix-dylan avatar svix-frank avatar svix-gabriel avatar svix-jplatte avatar svix-ken avatar svix-liam avatar svix-lucho avatar svix-nick avatar svix-nolan avatar svix-onelson avatar svix-stephanie avatar svix-yair avatar talhacohen avatar tasn avatar tkonya avatar whyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

svix-webhooks's Issues

Create Readme file

Create a readme file for all of the libraries

The readme should include:

  • How to use the library - covered in the docs. Should only have simple examples here (see next point).
  • Add simple examples for how to use the library
  • How to contribute to the repo
  • How to extend the repo in order to add your own custom logic on top of the library's validation (See)

Ruby: NameError in EndpointAPI#index

Steps to reproduce:
In a console:

irb(main):022:0> svix = Svix::Client.new('sk_REDACTED')
=> #<Svix::Client:0x00007fc9bc511200 @application=#<Svix::ApplicationAPI:0x00007fc9bc510c10 @api=#<Svix::ApplicationApi:0x00007fc9bc510be8 @api_client=#<Svix::ApiClie...

irb(main):023:0> app = 'app_REDACTED'
=> "app_REDACTED"

irb(main):024:0> svix.endpoint.list(app)
Traceback (most recent call last):
        1: from (irb):24
NameError (undefined local variable or method `app_id' for #<Svix::EndpointAPI:0x00007fc9bc510b70>)

Caused by:
https://github.com/svix/svix-libs/blob/5e85d147bdf7d012e643cd85158d4cdaee414e90/ruby/lib/svix/endpoint_api.rb#L9-L11
Unlike the rest of the methods in EndpointAPI, the argument is named str but the code uses app_id.

Move the wait-for functionality directly into the daemon

Based on this comment: #302 (comment)

The main advantage is that we can know the correct server was setup even when not using wait-for in docker.

Thoughts:

  • Behavior should probably be controlled with a flag (timeout) - disabled, infinite, whatever.
  • Check if the libs themselves can handle it, or whether we need to.
  • Can the "is active" check be a real connection, or should we just do a TCP connection check?

Java: ApiException stacktrace doesn't contain the actual error message

I noticed that when a request to Svix fails, the stacktrace doesn't contain a description of what went wrong exactly.

E.g. this is the stack trace you get when updating an endpoint fails:

...
2021-09-08T12:19:36.711851+00:00 app[web.1]: at java.base/java.lang.Thread.run(Thread.java:829)
2021-09-08T12:19:36.711851+00:00 app[web.1]: Caused by: com.svix.exceptions.ApiException:
2021-09-08T12:19:36.711851+00:00 app[web.1]: at com.svix.Utils.wrapInternalApiException(Utils.java:10)
2021-09-08T12:19:36.711851+00:00 app[web.1]: at com.svix.Endpoint.update(Endpoint.java:45)
2021-09-08T12:19:36.711852+00:00 app[web.1]: at util.SvixClient.updateEndpoint(SvixClient.java:57)
2021-09-08T12:19:36.711853+00:00 app[web.1]: ... 35 common frames omitted
2021-09-08T12:19:36.711853+00:00 app[web.1]: Caused by: com.svix.internal.ApiException:
2021-09-08T12:19:36.711853+00:00 app[web.1]: at com.svix.internal.ApiClient.handleResponse(ApiClient.java:1023)
2021-09-08T12:19:36.711854+00:00 app[web.1]: at com.svix.internal.ApiClient.execute(ApiClient.java:936)
2021-09-08T12:19:36.711854+00:00 app[web.1]: at com.svix.internal.api.EndpointApi.updateEndpointApiV1AppAppIdEndpointEndpointIdPutWithHttpInfo(EndpointApi.java:894)
2021-09-08T12:19:36.711854+00:00 app[web.1]: at com.svix.internal.api.EndpointApi.updateEndpointApiV1AppAppIdEndpointEndpointIdPut(EndpointApi.java:868)
2021-09-08T12:19:36.711854+00:00 app[web.1]: at com.svix.Endpoint.update(Endpoint.java:43)
2021-09-08T12:19:36.711855+00:00 app[web.1]: ... 36 common frames omitted

I assume there's something wrong with the request body, but I don't know what exactly.

Now I could write code to print out the response body inside the exception, but it would be nice if this was done out of the box.

Replace `unwrap` by `expect`, later by proper error handling

Bug Report

I am filing this as a bug report because this is very likely to show up sooner or later and will cause confusion ("where did this panic occur and why?!")

expect with a message is preferred over unwrap (if panics are intended and the state is unrecoverable) or replaced by proper error handling. Looking at all code here and below:

let cfg = cfg::load().unwrap();

Version

At least 0.51.

Vendor data present since version 0.53.0

Bug Report

Version

0.53.0 and 0.53.1

Description

Hey there,

My name is Tamir and I run security & quality assessment for Ruby libraries using Diffend.io.

While reviewing the changes for this lib, I noticed, that the vendor directory is being included.

Is this needed? Usually, it's added by mistake and causes:

a) confusion
b) problems when tracking changes
c) extensive library size

ref: LINK

Note that the package size grew from 62KB to 2.68MB due to the new vender added.

If the presence of vendor data is valid I would love the reasoning. Thanks!

Python (and other?): the openapi generated docs for the models aren't useful

For example, for ApplicationOut:

---

NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech

Do not edit the class manually.

Attributes:
  allowed_values (dict): The key is the tuple path to the attribute
      and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
  attribute_map (dict): The key is attribute name
      and the value is json key in definition.
  discriminator_value_class_map (dict): A dict to go from the discriminator
      variable value to the discriminator class name.
  validations (dict): The key is the tuple path to the attribute
      and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
  additional_properties_type (tuple): A tuple of classes accepted
      as additional properties values.

Add cargo cache to CI to make it faster

I don't think we are caching at the moment. Potentially because the server is in a subdirectory so target is in server/target/, though we definitely should.

Python: Cleanup Generated Models

Generated Models are created with arguments in alphabetical order eg EventTypeIn("description", "name") I don't love this, we probably want to wrap these models or see if we can generate them with named arguments

[nodejs] unable to mock SVIX lib using jest

There aren’t any properties on the Svix prototype, so spyOn operation on Svix.prototype.application isn't working.
This also means that jest.mock("svix") will also fail.

exposing the sivx instance outside to enble mock isn't desired approach.

@svix-liam

Health endpoint not included in Ruby bindings

Expected Behavior

irb(main):001:0> require 'svix'
=> true
irb(main):002:0> svix = Svix::Client.new('api-key')
=> #<Svix::Client:0x00007fc5d825e4a0 @application=#<Svix::ApplicationAPI:0x00007fc5d825d848  ...
irb(main):003:0> svix.health.get
=> nil # I'd actually like endpoints like this and deletes that return 204 to return something more useful than nil, but this is the pattern I expect currently

Actual Behavior

irb(main):003:0> svix.health.get
Traceback (most recent call last):
        2: from (irb):3
        1: from (irb):4:in `rescue in irb_binding'
NoMethodError (undefined method `health' for #<Svix::Client:0x00007fc5dd831990>)

format!() should not be used inside loops

format!() macro should be avoided in places where it is called repeatedly, e.g. inside loops like this https://github.com/svix/svix-webhooks/blob/main/server/svix-server/src/core/types.rs#L429. Even if that line is not inside a loop it will be called repeatedly on every property it serializes.

An alternative can be picked from this list https://github.com/hoodie/concatenation_benchmarks-rs and also check this discussion on Reddit https://www.reddit.com/r/rust/comments/t06hk7/string_concatenations_benchmarks_updated/.

Additional info: hoodie/concatenation_benchmarks-rs#11 (not merged yet at the time of reporting, but contains useful info on crates implementing fast concatenation).

Some of the macros benchmarked in that study have very good performance, but I would check their source and what they expand to before picking the winner. They all serve a slightly different purpose.

Create Java Library

Take a look at regen_openapi.sh and all of the files in javascript and python to see how to generate from the openapi spec, configure the generator to not generate some of the files, and make it into a package.
You can also look at https://github.com/etesync/etebase-java for how to create a java package. Though it's an Android package, which is a bit different to normal Java packages.

Keep the same API structure as there is in Python and JS (e.g. dh.message.create()).

Use clippy::pedantic

Feature Request

Run clippy in pedantic mode, -W clippy::pedantic.

Motivation

Right now clippy is run in standard mode, which is quite lenient and does not catch a lot of common nits. clippy::pedantic very rarely has false positives, but from experience it catches style mistakes that even relatively experienced rust devs make (looking at myself here....). Its suggestions will help very much with long term maintenance and enforce a stricter programming style. Especially when on-boarding new devs without Rust experience pedantic clippy acts as a teacher. :-)

This should be done ASAP while the code base is relatively small (at the time of writing, clippy raises 81 warnings). Adding this later on will be painful.

Proposal

Require -W clippy::pedantic in CI. This will require a bigger PR to implement all clippy suggestions so that CI passes.

Alternatives

  • Punt it until later (not a good idea; will be painful);
  • Ignore it (don't see a good reason to).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.