Skip to content

In chat hooks should not inject the user_id into context manually #99

@carmenlau

Description

@carmenlau

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

  1. User will be confusion how to get the user id as it is different from the core lambda
  2. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions