Now we inject the user id this way in chat sdk.
function chatHook(name, func) {
skygearCloud.op('chat:' + name + '_hook', function (param, options) {
const context = {userId: options.context.user_id};
func(param.args, context);
return {status: 'ok'};
}, {
userRequired: true,
keyRequired: true
});
}
That will have 2 problems
- User will be confusion how to get the user id as it is different from the core lambda
- After we add more data to the context, new data will be missed in the message hook. For example, we are going to add user verified flag.
Propose solution:
Should configure the container correctly with user for calling the lambda, should not inject the data manually in sdk