Giter VIP home page Giter VIP logo

Comments (7)

tomhuntley avatar tomhuntley commented on July 21, 2024 1

This seems to be a snoowrap issue, and I was able to fix by changing the app to "script" instead of "web app"

not-an-aardvark/snoowrap#54

from snoostorm.

brenapp avatar brenapp commented on July 21, 2024

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.

cyruslk avatar cyruslk commented on July 21, 2024

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.

brenapp avatar brenapp commented on July 21, 2024

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.

cyruslk avatar cyruslk commented on July 21, 2024

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.

brenapp avatar brenapp commented on July 21, 2024

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.

brenapp avatar brenapp commented on July 21, 2024

Thanks @tomhuntley !

from snoostorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.