Hi John, great series! I'm using them to build a custom transport for Amazon SQS, really having a lot of fun.
I am having issues passing the context (e.g. the FayeContext) to the user-land event handlers that are decorated with @EventPattern. For some reason, the context that the handler receives is always undefined. This also happens in the provided code, if you try to console the context in the addCustomer handler in the nestMicroservice app.
@roberto
: I can't reproduce this issue. I believe the relevant article section is in part 3. When I check out the part 3 branch of the repo and fire everything up, then issue a GET /customers request, I see the following in the log for the nestMicroservice app:
[Nest] 31573 - 04/04/2020, 10:22:50 AM [AppController] Faye Context: {"args":["/get-customers"]}
Which is, I think, what we expect. Are you seeing something different at that point?
I was trying to use the context on the addCustomer handler. The reasons why I was getting the context as undefined was because I wasn't using the @Ctx decorator.
Something else I found out is that when handling events, interceptors won't work. The ServerFaye is missing the this.send(response$) call when dealing with event handlers. Apart from that, I think the first version of my transport is done. Thanks!
Awesome. I'll put that interceptor issue on my to-do list (a bit long at the moment 😉) Thanks for reporting, and looking forward to seeing your transporter!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi John, great series! I'm using them to build a custom transport for Amazon SQS, really having a lot of fun.
I am having issues passing the context (e.g. the
FayeContext) to the user-land event handlers that are decorated with@EventPattern. For some reason, the context that the handler receives is alwaysundefined. This also happens in the provided code, if you try to console the context in theaddCustomerhandler in thenestMicroserviceapp.Hi Roberto, thanks for the feedback. Great to hear about the SQS project!
Let me take a look and see if I'm seeing the same thing. Might take a day or so.
Cool, thanks!
@roberto : I can't reproduce this issue. I believe the relevant article section is in part 3. When I check out the
part 3branch of the repo and fire everything up, then issue aGET /customersrequest, I see the following in the log for thenestMicroserviceapp:Which is, I think, what we expect. Are you seeing something different at that point?
Hi John, I just found out what was happening.
I was trying to use the context on the
addCustomerhandler. The reasons why I was getting the context as undefined was because I wasn't using the@Ctxdecorator.Something else I found out is that when handling events, interceptors won't work. The
ServerFayeis missing thethis.send(response$)call when dealing with event handlers. Apart from that, I think the first version of my transport is done. Thanks!Awesome. I'll put that interceptor issue on my to-do list (a bit long at the moment 😉) Thanks for reporting, and looking forward to seeing your transporter!