jovotech / jovo-framework

🔈 The React for Voice and Chat: Build Apps for Alexa, Messenger, Instagram, the Web, and more
https://www.jovo.tech
Apache License 2.0
1.67k stars 310 forks source link

GetUserId logic broken #630

Closed gshenar closed 4 years ago

gshenar commented 4 years ago

I'm submitting a...

Expected Behavior

this.getUserId() and this.$user.GetId() should return the same value

Current Behavior

Ran into a ton of crazy issues once I implemented skill events. Realized that this.getUserId returns null within skill event since the session object isnt populated. this.$user.getId() works though.

There is a mismatch between the two methods on AlexaSkill and AlexaRequest. As you can see, when the user is on the session its fine. But on AlexaSkill, the userId property is reading from context.user when it should be context.System.user.

https://github.com/jovotech/jovo-framework/blob/1f7fedca249b9d9c3018a4c2ba2646c7af378571/jovo-platforms/jovo-platform-alexa/src/core/AlexaSkill.ts#L144

https://github.com/jovotech/jovo-framework/blob/1f7fedca249b9d9c3018a4c2ba2646c7af378571/jovo-platforms/jovo-platform-alexa/src/core/AlexaRequest.ts#L532

Error log

N/A

Your Environment

KaanKC commented 4 years ago

Good catch. this.getUserId() should actually call this.$user.getId() instead of accessing the request itself. this.getUserId() is actually deprecated.

Will fix it later today. Thanks!

aswetlow commented 4 years ago

Fixed and published