Comments (7)
This seems to be a snoowrap issue, and I was able to fix by changing the app to "script" instead of "web app"
from snoostorm.
Were I to bet, Reddit is resulting some sort of content I wasn't expecting. Try running multiple times to see if you get the same error every time.
from snoostorm.
Hey - thanks for your reply! I'm running the CommentStream
with nodemon
and I only have these errors, I'm not able to access the actual comments. Here's the code to reproduce the error:
const express = require('express');
const app = express();
const http = require('http').Server(app);
const port = process.env.PORT || 5000;
const bodyParser = require('body-parser');
const fs = require('fs');
const axios = require("axios");
const { CommentStream } = require("snoostorm");
const Snoowrap = require('snoowrap');
const Snoostorm = require('snoostorm');
var config = require('./config.js');
const r = new Snoowrap({
userAgent: 'franklin_ford',
clientId: config.reddit_client_id,
clientSecret: config.reddit_client_secret,
username: config.reddit_username,
password: config.reddit_password
});
const stream = new CommentStream(r, { subreddit: "all", results: 25 });
app.listen(port, () => {
console.log('listening on port ' + port)
});
Let me know if there's something I'm doing wrong. Thanks!
from snoostorm.
I'm a little short on time right now but lemme see what I can do.
Your syntax looks correct, except for the results
option. The options object extends Snoowrap Listing Options (see below)
export interface SnooStormOptions extends ListingOptions {
pollTime?: number;
subreddit?: string;
}
// from snoowrap
export interface ListingOptions {
limit?: number;
after?: string;
before?: string;
show?: string;
count?: number;
}
This means that instead of results
you should use limit
. That may be causing your issue, but since that option has a default, I wouldn't think that is the issue.
Looking at your stack trace, it appears like snoowrap is the origin of the error. But I'm not sure how to reproduce. Try removing all the options, as subreddit: all
is the default anyway.
from snoostorm.
Hey - I changed the results
inside my code and this error still appear.
This:
const r = new Snoowrap({
userAgent: 'franklin_ford',
clientId: config.reddit_client_id,
clientSecret: config.reddit_client_secret,
username: config.reddit_username,
password: config.reddit_password
});
const stream = new CommentStream(r, { subreddit: "all" });
app.listen(port, () => {
console.log('listening on port ' + port)
});
or this:
const stream = new CommentStream(r, { subreddit: "all", limit: 25 });
still get me:
(node:3666) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
at /Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/snoowrap/dist/request_handler.js:246:38
at tryCatcher (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/promise.js:694:18)
at _drainQueueStep (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/async.js:17:14)
at processImmediate (timers.js:632:19)
(node:3666) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3666) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
from snoostorm.
Cannot replicate. Make sure you have the most modern version of snoostorm
and snoowrap
;
npm i snoostorm@latest snoowrap@latest
Here's the lockfile entry for snoowrap on the snoostorm repo, see if it makes your local install
snoowrap@^1.11.3:
version "1.15.2"
resolved "https://registry.yarnpkg.com/snoowrap/-/snoowrap-1.15.2.tgz#2086fcb911c64356c04a6e601e2eed23079acaa4"
dependencies:
bluebird "^3.4.1"
lodash "^4.5.1"
promise-chains "^0.3.11"
request-promise "^3.0.0"
ws "^1.1.1"
from snoostorm.
Thanks @tomhuntley !
from snoostorm.
Related Issues (20)
- [REMOVED]
- Memory issue with long running process HOT 2
- ModMailStream not firing on new mod mail HOT 3
- can't use r/all HOT 1
- TypeError: client.getNewComments is not a function HOT 2
- I can't get comments? HOT 2
- Getting the username of the user an another user replied to in the InboxSteam HOT 2
- RFC: Modularize API Library HOT 1
- How do I see the ratelimits info
- Does this poll, or use the stream api? HOT 4
- Unnecessary production dependency of Snyk HOT 1
- CommentStream appears to drop a significant amount of comments from /r/all. HOT 2
- Snoostorm is not a constructor HOT 5
- Get only unread messages in inbox stream/filtering the inbox HOT 2
- Ratelimited always HOT 1
- way to stop commentStream HOT 1
- Documentation? HOT 2
- Trying to TDD with jest HOT 1
- Requesting clarification regarding exception handling
- Ratelimit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snoostorm.