GetStream / stream-js

JS / Browser Client - Build Activity Feeds & Streams with GetStream.io
https://getstream.io
BSD 3-Clause "New" or "Revised" License
331 stars 110 forks source link

Can't add reaction (like) "user_id is a required field" #534

Closed monzeromer-lab closed 1 year ago

monzeromer-lab commented 1 year ago

Annotation 2023-01-17 153449

I'm trying to add a new reaction (like) i did pass the userId to the add function but i still get

Error:

{
"detail":"Errors for fields 'user_id'",
"status_code":400,
"code":4,
"exception":"InputException",
"exception_fields":{
"user_id":["user_id is a required field"]},
"duration":"0.18ms",
"more_info":"https://getstream.io/docs/api_error_responses"
}

with HTTP status code 400

so i tried editing the package code as seen in the attached picture

i edited the body object userId property from

var body = {
        id: id,
        activity_id: activity instanceof Object ? activity.id : activity,
        kind: kind,
        data: data || {},
        target_feeds: this._convertTargetFeeds(targetFeeds),
        user_id: data.userId
      };

to:

var body = {
        id: id,
        activity_id: activity instanceof Object ? activity.id : activity,
        kind: kind,
        data: data || {},
        target_feeds: this._convertTargetFeeds(targetFeeds),
        user_id: data.userId
      };

and everything works fine after that

ferhatelmas commented 1 year ago

Where does the screenshot come from? If it's from this SDK, could you share link to source code ? What is the version of SDK ? Also, finally user id & id is given to add as 4th parameters.