vardius/go-api-boilerplate

register-user-with-email - Unauthorized

mar1n3r0 opened this issue · 0 comments

Looking at the router code it seems to be a public route just like list-users and get-user yet it's returning unauthorized just like me and change-email-address which are behind the firewall.

That seems like a fix: #38
I get HTTP status 201 Created, it's not saved to the database though.

DEBUG: [CommandBus|Publish]: user.RegisterWithEmail {Email:example@example.com}
2019/12/25 21:12:57.910400 DEBUG: [EventBus|Publish]: user.WasRegisteredWithEmail {"id":"9c79bb8e-30e7-4695-9bbf-dc7b1950e856","metadata":{"type":"user.WasRegisteredWithEmail","stream_id":"af530f9c-98c6-474a-b0b4-cb6d3ed1017c","stream_name":"user.User","stream_version":0,"occurred_at":"2019-12-25T21:12:57.893211786Z"},"payload":{"id":"af530f9c-98c6-474a-b0b4-cb6d3ed1017c","email":"example@example.com"}}

The event was published but it seems like the event handler never subscribed.

Edit: The pubsub gRPC server didn't have the setServingStatus to serving. Not sure if the user service is the right place for it but it did the trick. The second commit should have fixed it.