Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

newsFeeds[slug].follow is not a function #23

Open
yuccayucca opened this issue Sep 8, 2017 · 14 comments
Open

newsFeeds[slug].follow is not a function #23

yuccayucca opened this issue Sep 8, 2017 · 14 comments

Comments

@yuccayucca
Copy link

yuccayucca commented Sep 8, 2017

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
Copy link
Author

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));

@dwightgunning
Copy link
Contributor

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?

@yuccayucca
Copy link
Author

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.

@astrotars
Copy link
Contributor

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

@yuccayucca
Copy link
Author

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

@astrotars
Copy link
Contributor

@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!

@yuccayucca
Copy link
Author

@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..?

@dwightgunning
Copy link
Contributor

@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 

@yuccayucca
Copy link
Author

@dwightgunning here's the latest commit: 2649b9b34dec8eecf2d8f0972e5c21070a9c5ca5

@dwightgunning
Copy link
Contributor

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 a5428aa 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?

@yuccayucca
Copy link
Author

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

@dwightgunning
Copy link
Contributor

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

@astrotars
Copy link
Contributor

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!

@dwightgunning
Copy link
Contributor

dwightgunning commented Sep 29, 2017

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants