Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Mina Luke
    @menocomp
    @bojand I am defining all date fields in proto files as google.proto.timestamp which worked correctly by using (seconds/nanos) however I have to write a JS function to convert every single date field in the response object to be timestamp.
    Also, in the calling service, I have to reverse all those timestamps to their original JS dates.
    I am curious if there is a middleware or something that can achieve this automatically for me.
    Bojan
    @bojand
    Hmm the only thing that I can think of that may help is https://github.com/malijs/param
    That's on the incoming request
    For response you could just have a regular middleware
    Or try something like this if you add a method to the response https://github.com/malijs/transform
    Peter Whitesell
    @peterwhitesell_twitter
    I want to use Mali in a typescript project and am having trouble setting the response in a handler for a unary . Following the docs and examples, I try to set ctx.res = { foo: 'bar' }, but I get the typescript error "Type '{ foo: string; }' is not assignable to type 'GrpcResponse'". Has anyone here written a Mali server with TypeScript and has any advice on this?
    Bojan
    @bojand
    Hello, was away on vacation. I see the issue on GH, and i’ll look into this… Don’t really use TS. Hope to have it resolved soon-ish.
    Peter Whitesell
    @peterwhitesell_twitter
    @bojand thank you for looking into this :thumbsup:
    Stivenson
    @stivenson
    hi all, a cordial greeting ..
    Mali.js is awesome i have been learn it currently ... :)
    Please, I have a small question:
    I'm trying to check of tests' coverage with mocha, specifically with the command nyc mocha but the results are not correct. Any idea to check the coverage of my mali.js' tests?
    My tests perform calls to the grpc methods.
    Bojan
    @bojand

    Hello, if you just run npm test you should get a coverage report:

    -------------|----------|----------|----------|----------|-------------------|
    File         |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
    -------------|----------|----------|----------|----------|-------------------|
    All files    |    98.93 |    94.12 |    98.48 |    99.18 |                   |
     app.js      |    99.41 |    95.45 |      100 |     99.4 |               323 |
     context.js  |      100 |      100 |      100 |      100 |                   |
     lo.js       |      100 |      100 |      100 |      100 |                   |
     request.js  |      100 |      100 |      100 |      100 |                   |
     response.js |      100 |      100 |      100 |      100 |                   |
     run.js      |    96.36 |    93.75 |    94.74 |    98.11 |                89 |
     utils.js    |    98.55 |    87.27 |      100 |    98.55 |                57 |
    -------------|----------|----------|----------|----------|—————————|

    Coverage is also available online: https://coveralls.io/github/malijs/mali

    Stivenson
    @stivenson
    @bojand oh thanks. I'm going to try adding babel to the coverage, because i'm using ES6 classes in node v10.
    The link is cool...
    Bojan
    @bojand
    hmm not sure i understand… there is no need for babel
    node 10 supports classes
    mali itself does not use babel or any transpiler. it’s plain javascript. what you see is what’s run.
    Stivenson
    @stivenson

    yes, @bojand yo're right, but of moment my coverage is impossible

    auth.js | 0 | 0 | 0 | 0 | 1,3,5,7,8,13 |
    core.js | 0 | 0 | 0 | 0 |... 78,82,86,91,92 |
    giftcard.js | 0 | 0 | 0 | 0 |... 41,42,43,48,53 |

    What might be ? :( i see all fine..

    only an unit-test to a file have the real coverage (it's a test that no use any proto)

    i think so: The coverage is not able to follow the execution of the functions when they are called through proto.
    Bojan
    @bojand
    Hello, not sure I understand tbh… I think I would need more info. If you have like integration / functional tests that’s running requests against a service and you are trying to test coverage of your service, which is running as a separate process, then you probably need to manually instrument your service and run the instrumented code. https://istanbul.js.org/docs/advanced/instrument/
    Stivenson
    @stivenson
    ok @bojand . i'll try its.
    Anh Tu Nguyen
    @xgenvn
    Hi guys, is there any example with typescript?
    Bojan
    @bojand
    Hello, not in the examples repo; there may be some out in the wild that I do not know about.
    Mateusz Tkacz
    @Xardas_gitlab
    Hi. Is there any way to add multiple proto files to server instance? Example: const app = new Mali([PROTO_PATH1, PROTO_PATH2]);
    Bojan
    @bojand
    @Xardas_gitlab Hello yest this should be possible using addService(). Example in tests:
    https://github.com/malijs/mali/blob/master/test/create.test.js#L300
    Mateusz Tkacz
    @Xardas_gitlab
    @bojand This is what i was looking for! Thanks.
    Andrew Watts-Curnow
    @andywatts

    Has anyone got a gRPC keepalive configuration that closes channels after x seconds of failed pings?
    I've tried... 'app.start('0.0.0.0:8080', creds, {"grpc.keepalive_time_ms":1000,"grpc.keepalive_timeout_ms": 2000 })'

    Do I need similar settings in my c# client? TIA

    Bojan
    @bojand

    Hmm these options should be passed properly and handled by underlying node and C++ grpc lib. I don’t have much time to test things out atm, but you could try additional logging on the server, for example:

    GRPC_VERBOSITY=debug GRPC_TRACE=tcp,http,api,timer,timer_check,connectivity_state node myapp.js

    I believe those should capture the ping checks. You can take a look at the available TRACE flags: https://github.com/grpc/grpc/blob/master/doc/environment_variables.md

    Andrew Watts-Curnow
    @andywatts
    @bojan Thankyou
    Andrew Watts-Curnow
    @andywatts
    Any idea how to serve a second health-check service from Mali?
    https://github.com/grpc/grpc/blob/master/doc/health-checking.md
    /doh. Is it as simple as mali.addService...
    Andrew Watts-Curnow
    @andywatts
    Nope, not that simple.
    I think I need to use Grpc server's addService, but can't get gRPC server without starting Mali...and can't add services once started.
    Bojan
    @bojand
    Hi, isn't that just using addService?
    Andrew Watts-Curnow
    @andywatts
    Using the addService method on the grpc server.
    Rather than Mali’s own addService method.
    Joshua Gallagher
    @Joshgallagher
    Could Mali be used with NestJS's gRPC client config? Does anyone forsee any issues with this? I wanted to use NestJS as the Gateway as it's gRPC lacks support for metadata and advanced error handling
    Also, has Mali been used in production anywhere?
    washanhanzi
    @washanhanzi
    Mali seems auto convert the snake_case in proto file to CamelCase, however in the route_guide example, the snake_case still being used, I am quite confused. Anyone can help me on this?
    Anon Anon
    @orion3000
    The logger middleware does not work when I am using static code is there a way to fix this?