stream-node-orm icon indicating copy to clipboard operation
stream-node-orm copied to clipboard

newsFeeds[slug].follow is not a function

Open yuccayucca opened this issue 7 years ago • 14 comments

I've been following the Node.js example and I keep getting newsFeeds[slug].follow is not a function and newsFeeds[slug].unfollow is not a function, while providing all the correct data.

I looked into the module's FeedManager.js file, as the error was being generated there and swapped the enhanced loop for (var slug in newsFeeds) { on lines 52 and 64 to the regular for(var slug=0; slug< newsFeeds.length; slug++){ and it worked perfectly.

Do you know why might this be happening and is there a way to fix this without making a custom module?

yuccayucca avatar Sep 08 '17 03:09 yuccayucca

Though swapping the for loop allowed following, the flat and aggregated feeds did not have access to the followed user feed. Crude, but this fixes it: ps.push(newsFeeds.timeline.unfollow(this.settings.userFeed, targetUserId)); ps.push(newsFeeds.timeline_aggregated.unfollow(this.settings.userFeed, targetUserId));

yuccayucca avatar Sep 13 '17 06:09 yuccayucca

Hi, thanks for posting about these challenges and asking questions. Apologies for not getting back to you sooner.

Are you able to confirm the list of newFeeds is populated appropriately? Given the errors cascade through to subsequent calls, I suspect you may have some mis-configuration and they app is simply misbehaving as a result.

There's also a possibility of something environment related. Can you confirm the version of Node you're running and that you've got latest commits from our master branch?

dwightgunning avatar Sep 14 '17 14:09 dwightgunning

Hi @dwightgunning, thanks for your reply.

The feeds are mostly fine, although sometimes I get un-enriched results i.e. object: 'Follow: id' opposed to the usual breakdown to user object, target object, etc. Still trying to work this out, could this also be related?

I'm running Node v6.2.1 and getstream-node module is v1.5.0.

yuccayucca avatar Sep 19 '17 04:09 yuccayucca

@yuccayucca Any chance you're able to test this against the latest version of Node (8.5.0)?

astrotars avatar Sep 19 '17 17:09 astrotars

@nparsons08 I can locally, but our servers use an even older version than that - 4.4.7. Can this pose problems in the future?

yuccayucca avatar Sep 19 '17 20:09 yuccayucca

@yuccayucca I installed the latest version of the code and ran into issues with Node v6.2.1; however, the issue that I faced was due to railing commas (something that is not supported in outdated versions of Node). That said, my suspicion is that it is an issue related to your Node version. Out of curiosity, when did you clone the repo? If you can provide a commit SHA, that would be more helpful. Thank you!

astrotars avatar Sep 20 '17 17:09 astrotars

@nparsons08 you're right, I had to remove those commas as well. Node version it is, then. I'm not sure when exactly I cloned it, I'd say about two and a half weeks ago. Commit SHA of the cloning or..?

yuccayucca avatar Sep 21 '17 01:09 yuccayucca

@yuccayucca - yep, if you can grab the SHA of the commit you're working against, we can be more sure about the code you're working with. This repo has had quite a few changes going into the master branch over the last few weeks so depending on when you cloned or last pulled, you may not have the latest.

$ git log -1 

dwightgunning avatar Sep 21 '17 06:09 dwightgunning

@dwightgunning here's the latest commit: 2649b9b34dec8eecf2d8f0972e5c21070a9c5ca5

yuccayucca avatar Sep 22 '17 01:09 yuccayucca

I can't spot that commit in our repository. So I suspect you've probably made some new commits in your local repository (I probably should have considered that when phrasing the question).

Are you able to check that you've got a5428aaf the current HEAD commit in our master branch? You can run git log without the -1 to get more of the history.

It'd actually be even easier to help you with this if you have pushed your changes to a fork of the repository in Github. Then we can clone it and see the exact code you're working with. Would that be an option?

dwightgunning avatar Sep 22 '17 11:09 dwightgunning

It's true that I made a commit after that (just removed commas in models.js), but the previous one was: commit 2649b9b34dec8eecf2d8f0972e5c21070a9c5ca5 Author: Nick Parsons <[email protected]> Date: Fri Aug 25 14:57:39 2017 -0600 Update app.json

yuccayucca avatar Sep 22 '17 16:09 yuccayucca

Now I see it. That commit is from a different Stream-Example-Nodejs. Let us take a closer look.

dwightgunning avatar Sep 22 '17 16:09 dwightgunning

Hi @yuccayucca, I was able to have a deeper look over the weekend and it's likely due to an outdated version of Node.js. Are you able to upgrade your local environment in addition to your servers? For what it's worth, the latest versions of Node come with several feature upgrades and bug fixes – so upgrading is highly recommended.

Furthermore, is the app that you're building a proof of concept or something you're looking to deploy into production? Just trying to wrap my head around your use-case.

Cheers!

astrotars avatar Sep 25 '17 16:09 astrotars

@yuccayucca - hoping to get a response for you here - can you respond on those questions from Nick? We typically close off issues that aren't clear bugs and are left unattended for 14 days. Of course we're hoping to hear from you and helping you get this sorted.

dwightgunning avatar Sep 29 '17 11:09 dwightgunning