-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node-red-node-twitter error by posting a tweet #665
Comments
I observed the same, but suddenly everything went back to normal. Guessing this was a Twitter glitch somehow. |
Oh you are right. Now it works somehow. Thank you! 👍 |
I am currently getting this, the stack reports:
That line of code is:
I dumped the result body and it was showing:
I just checked on Twitter's documentation though and they claim the error should be compatible with the existing code. Having the node's code so dependent on Twitter's API response structure could be considered a bad thing, but then knowing what the fallback should be is tricky. I've just tried the following which is quite "belt and braces" but might be considered overkill?
So in my circumstance the second if clause is triggering, but if that failed in the future it would fallback on just dumping out the entire body and reporting the status. Any thoughts? |
@johnmckerrell adding better error handling would be welcome. The error you're hitting is because the credentials you are using don't have permission to post to the stream. I imagine that could be a common mistake made when setting up the credentials - so making sure the node reports back properly would be useful. If its something you wanted to PR, I happily take a look. |
Thanks @knolleary yeah as soon as I actually had the error message I fixed the problem on my side. If the code I posted above seems reasonable I'll be happy to PR it sometime, first time committing so wasn't sure whether that code would make sense but I guess the ideal place to discuss it is on a PR! |
(Worth reopening this issue until the fix is out? I don't appear to have privileges) |
The error is in Twitter App permissions. When you generate an app in Twitter, the default permissions are only Read (Read Tweets and profile information), so you need to change it for "Read and Write" or "Read + Write + Direct Messages".
After that you have to regenerate the Access Token & Secret Token to have the same permissions as the application:
After that you have to reconfigure the node in node-red with the new tokens and keys and now should work. That's how I find the solution to the problem. So for the error improvement, I will open the Issue again. |
I love it when I'm trying to solve a problem and I find @johnmckerrell was there before me ;) |
Which node are you reporting an issue on?
Node-Red-Node-Twitter
What are the steps to reproduce?
What happens?
A message "TypeError: Cannot read property '0' of undefined" displays in debug tab
What do you expect to happen?
Tweet Hello world in the account configured
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: