Closed AndrewRudyk closed 4 years ago
Hello @AndrewRudyk Can you please enable and share all logs with us?
Stream Feed v.2.2.3
🔑 4x2h5rkwczkz
🔗 https://api.stream-io-api.com/api/v1.0/
🐴 [25/06 18:42:33.994] 🧹 Disconnect. Reset Client User, Token, URLSession and WebSocket. Old user id:
},
"verb" : "add",
"descriptionText" : "Caption (optional)",
"posterProfileId" : "tgDePuwzVZha9Ankw2Hu",
"time" : "2020-06-19T12:10:40.716601",
"postType" : "Photo",
"latest_reactions" : {
},
"imageIds" : [
"cePH464cjkPaWZMu4MAL",
"wyv5rnziWKNm6uXYKubk",
"yhTw4GsVxJSS7tAUZhXx",
"UdwYui5WpVMadrgxgajs",
"Upzdv5LGR68Rp9JCeVCu"
],
"object" : "956c39krs48BHviSfZ5S",
"actor" : "tgDePuwzVZha9Ankw2Hu",
"origin" : null,
"latest_reactions_extra" : {
},
"own_reactions" : {
},
"postId" : "956c39krs48BHviSfZ5S",
"target" : "",
"titleText" : "sdf",
"foreign_id" : ""
},
{
"id" : "8336377c-b21f-11ea-ad2a-122f0bb6aafb",
"reaction_counts" : {
},
"verb" : "add",
"descriptionText" : "(optional)",
"posterProfileId" : "tgDePuwzVZha9Ankw2Hu",
"time" : "2020-06-19T11:25:00.332019",
"postType" : "Photo",
"latest_reactions" : {
},
"imageIds" : [
"Xr675nXccs5ezj2baD2T"
],
"object" : "310d4JXPjPYcsdTjajek",
"actor" : "tgDePuwzVZha9Ankw2Hu",
"origin" : null,
"latest_reactions_extra" : {
},
"own_reactions" : {
},
"postId" : "310d4JXPjPYcsdTjajek",
"target" : "",
"titleText" : "sdfsdf",
"foreign_id" : ""
},
{
"id" : "164d1d06-b20d-11ea-9dd0-122f0bb6aafb",
"reaction_counts" : {
},
"verb" : "add",
"descriptionText" : "(optional)",
"posterProfileId" : "tgDePuwzVZha9Ankw2Hu",
"time" : "2020-06-19T09:13:06.669287",
"postType" : "Photo",
"latest_reactions" : {
},
"imageIds" : [
"XjKCiuGWqGkAteXv9QY7"
],
"object" : "27ff9a2P2mKhCWJGjf9g",
"actor" : "tgDePuwzVZha9Ankw2Hu",
"origin" : null,
"latest_reactions_extra" : {
},
"own_reactions" : {
},
"postId" : "27ff9a2P2mKhCWJGjf9g",
"target" : "",
"titleText" : "sdfsdfsdf",
"foreign_id" : ""
},
{
"id" : "bb64feaf-b208-11ea-a077-1254437355c5",
"reaction_counts" : {
},
"verb" : "add",
"descriptionText" : "(optional)",
"posterProfileId" : "tgDePuwzVZha9Ankw2Hu",
"time" : "2020-06-19T08:41:56.166213",
"postType" : "Photo",
"latest_reactions" : {
},
"imageIds" : [
"6xVx9XpTjcDVHuhLNnRZ"
],
"object" : "0c11eZyqCPcKd9RVP495",
"actor" : "tgDePuwzVZha9Ankw2Hu",
"origin" : null,
"latest_reactions_extra" : {
},
"own_reactions" : {
},
"postId" : "0c11eZyqCPcKd9RVP495",
"target" : "",
"titleText" : "sdfsdf",
"foreign_id" : ""
},
{
"id" : "969fe47b-b208-11ea-92b8-0a0d7a10423a",
"reaction_counts" : {
},
"verb" : "add",
"descriptionText" : "(optional)",
"posterProfileId" : "tgDePuwzVZha9Ankw2Hu",
"time" : "2020-06-19T08:40:54.476505",
"postType" : "Photo",
"latest_reactions" : {
},
"imageIds" : [
"VDudUng3pK5xAmYCcAMw"
],
"object" : "c43edsryYwgx9WEbzPEM",
"actor" : "tgDePuwzVZha9Ankw2Hu",
"origin" : null,
"latest_reactions_extra" : {
},
"own_reactions" : {
},
"postId" : "c43edsryYwgx9WEbzPEM",
"target" : "",
"titleText" : "sdfsdfsd",
"foreign_id" : ""
}
], "next" : "", "duration" : "10.85ms" } GetStreamService getPosts error: JSON decoding error: The data couldn’t be read because it isn’t in the correct format.. Data: 2582 bytes
I had a deeper look at your Framework. I have error in line 54, file "Result+ParseResponse.swift" (GetStream -> Core): ▿ JSON decoding error: The data couldn’t be read because it isn’t in the correct format.. Data: 2582 bytes ▿ jsonDecode : 3 elements
Hello @AndrewRudyk How did you create the posts on this feed? Can you share the code you've created to post on that feed?
Hi @b-onc The following code is called on the server:
const activity = {
actor: `${posterProfileId}`,
verb: 'add',
object: postId,
postId,
posterProfileId,
descriptionText,
titleText,
postType,
};
const client = stream.connect(apiKey, secret, appId, { location: 'us-east' });
const userFeed = client.feed('feed_one_flat', `${posterProfileId}`);
await userFeed.addActivity(activity);
@AndrewRudyk the argument
actor: `${posterProfileId}`,
is causing the error. actor
field expects a full user. You can use SDK to post some stuff, then inspect the getPost
result's actor
field to see how our SDK posts.
@b-onc what is it "full user"? JSON hasn't empty fields with "actor".
@AndrewRudyk actor
fields expects a user object, such as:
"actor" : {
"id" : "dconroy",
"data" : null,
"updated_at" : "2020-01-18T07:59:53.958398Z",
"created_at" : "2020-01-18T07:59:53.958398Z"
}
@b-onc
We have example from documentation where the "string" is required and this works well on the our website and Android SDK:
https://getstream.io/docs/adding_activities/?language=js
We can only send:
"actor" : {
"id" : "dconroy",
?
@AndrewRudyk actor
can be a string, but GetStreamActivityFeed
expects the user object so it can display data regarding it. The examples are usable via the GetStream pod, our Core library for Stream Feeds. If you want to use GetStreamActivityFeed library, actor
should be a user object.
"actor" : {
"id" : "tgDePuwzVZha9Ankw2Hu",
"data": {
"name": "User Name", // can be null
"profileImage": null
}
}
would work. If you pass null
for name
, user name won't be visible in GetStreamActivityFeed UI.
@b-onc Hi We are trying to send an object in actor property on the backend. Here is code snippet from the backend:
const stream = require('getstream');
const client = stream.connect(
process.env.GET_STREAM_API_KEY,
process.env.GET_STREAM_API_SECRET,
process.env.GET_STREAM_APP_ID,
);
const getClient = () => client;
const getFeed = (id) => client.feed('feed_one_flat', id);
const activity = {
actor: {
id: posterProfileId,
data: {
name: null,
profileImage: null,
},
},
verb: 'add',
object: postId,
foreign_id: postId,
time: createdAt,
postId,
posterProfileId,
descriptionText,
titleText,
postType,
};
const userFeed = getFeed(posterProfileId);
const result = await userFeed.addActivity(activity);
In the mobile app we are getting this response and the same error. It look likes actor is still treated as a string, not an object:
{
"results" : [
{
"id" : "35a9e590-bac2-11ea-8080-80003bb39bb0",
"reaction_counts" : {
},
"videoIds" : [
"PwwzKECB01I01eM4cZsR6m500003ZOFIsagjj8lzSjtZt6E"
],
"verb" : "add",
"descriptionText" : "dt",
"posterProfileId" : "w75K3rXL9EF4iuy7rkrW",
"time" : "2020-06-30T11:09:47.497000",
"postType" : "BandsPost",
"latest_reactions" : {
},
"imageIds" : [
"WhctNcSzztTfDQM2KuHC"
],
"object" : "c4c29Pt49gENVQmgzcF3",
"actor" : "{\"data\":{\"name\":null,\"profileImage\":null},\"id\":\"w75K3rXL9EF4iuy7rkrW\"}",
"origin" : null,
"latest_reactions_extra" : {
},
"own_reactions" : {
},
"postId" : "c4c29Pt49gENVQmgzcF3",
"target" : "",
"titleText" : "tt",
"foreign_id" : "c4c29Pt49gENVQmgzcF3"
}
],
"next" : "",
"duration" : "9.05ms"
}
Actor property: "actor" : "{\"data\":{\"name\":null,\"profileImage\":null},\"id\":\"w75K3rXL9EF4iuy7rkrW\"}",
Hello. I have lates version Swift-activity-feed (2.2.3). Initialization and UserRegistration is successful. When I am trying to load Activity I have an error: "JSON decoding error: The data couldn’t be read because it isn’t in the correct format.." JSON in logs is readable and has all the info about my Activitys(Posts).
I use code for request: guard let feedId = FeedId(feedSlug: "timeline") else { return } let timelineFlatFeed = Client.shared.flatFeed(feedId) let presenter = FlatFeedPresenter(flatFeed: timelineFlatFeed)