Skip to content
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

Error running in parallel #46

Open
cmp-ams opened this issue Dec 13, 2017 · 2 comments
Open

Error running in parallel #46

cmp-ams opened this issue Dec 13, 2017 · 2 comments

Comments

@cmp-ams
Copy link

cmp-ams commented Dec 13, 2017

Hello,

Executing the following command ends in an error:

$ offline-issues --state all USER/REPO
{ Error: read ECONNRESET
    at _errnoException (util.js:1024:11)
    at TLSWrap.onread (net.js:618:25) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' } 'Error running in parallel.'
Error running in parallel.
/usr/local/lib/node_modules/offline-issues/src/index.js:121
      issue.comments.forEach(function (comment) {
                     ^

TypeError: issue.comments.forEach is not a function
    at Request._callback (/usr/local/lib/node_modules/offline-issues/src/index.js:121:22)
    at Request.self.callback (/usr/local/lib/node_modules/offline-issues/node_modules/request/request.js:186:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/offline-issues/node_modules/request/request.js:1163:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/offline-issues/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:312:30)
    at emitNone (events.js:110:20)

Any idea on how to get around this?

Thanks!

@adamcbuckley
Copy link

I worked around the problem by editing index.js:121 and changing it as follows:

if(issue.comments.forEach instanceof Function) issue.comments.forEach(function (comment) {

I was also required to make a similar fix to writehtml.js:60

@Wilfred
Copy link

Wilfred commented Aug 13, 2018

That definitely helps, although I still get the issue on some repos, such as Wilfred/helpful. It works on the other repos I've tried though. Here's a diff:

diff --git i/src/index.js w/src/index.js
index 88d11fb..6d036e0 100644
--- i/src/index.js
+++ w/src/index.js
@@ -118,7 +118,7 @@ module.exports = function (token, options, cb) {
       if (err) return cb(err, 'Error in request for comments.')
 
       issue.comments = body
-      issue.comments.forEach(function (comment) {
+      if(issue.comments.forEach instanceof Function) issue.comments.forEach(function (comment) {
         comment.created_at = new Date(comment.created_at).toLocaleDateString()
       })
       issueData.push(issue)
diff --git i/src/writehtml.js w/src/writehtml.js
index 721a1ff..085649c 100644
--- i/src/writehtml.js
+++ w/src/writehtml.js
@@ -63,9 +63,12 @@ function repoDetails (issue) {
 function parseBody (issue) {
   if (issue.body === null) issue.body = ''
   else issue.body = marked(issue.body)
-  issue.comments = issue.comments.map(function (issue) {
-    issue.body = marked(issue.body)
-    return issue
-  })
+
+  if(issue.comments.map instanceof Function) {
+    issue.comments = issue.comments.map(function (issue) {
+      issue.body = marked(issue.body)
+      return issue
+    })
+  }
   return issue
 }

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

No branches or pull requests

3 participants