Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Crashes with 'invalid data' #2

Open
anseljh opened this issue Aug 16, 2016 · 1 comment
Open

Crashes with 'invalid data' #2

anseljh opened this issue Aug 16, 2016 · 1 comment
Assignees

Comments

@anseljh
Copy link
Member

anseljh commented Aug 16, 2016

After installing fresh from npm and putting together a super simple project:

Ansel@BACCHUS /cygdrive/c/Users/ansel/Code/kr-new-forms
$ cftemplate terms.cftemplate test.json
net.js:617
    throw new TypeError('invalid data');
    ^

TypeError: invalid data
    at Socket.write (net.js:617:11)
    at C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\cftemplate:21:22
    at C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\node_modules\plaintemplate\index.js:29:18
    at handler (C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\node_modules\map-async\index.js:30:36)
    at C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\node_modules\plaintemplate\index.js:29:18
    at handler (C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\node_modules\map-async\index.js:30:36)
    at C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\index.js:124:15
    at done (C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\node_modules\async.util.createtester\index.js:6:21)
    at C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\node_modules\async.util.once\index.js:6:12
    at C:\Users\ansel\AppData\Roaming\npm\node_modules\cftemplate\node_modules\async.eachofseries\index.js:26:28

I can add you to the repo if you want to take a look.

Here's what the tests output, too (npm test). Looks like mostly linebreak garbage from Windows/Cygwin:

Ansel@BACCHUS /cygdrive/c/Users/ansel/Code/cftemplate
$ npm test

> cftemplate@1.0.3 test C:\Users\ansel\Code\cftemplate
> tape test.js

TAP version 13
# from-api
ok 1 null
ok 2 should be equal
# if-false
ok 3 null
ok 4 should be equal
# if-null
ok 5 null
ok 6 should be equal
# if-true
ok 7 null
ok 8 should be equal
# require-content-with-children
ok 9 null
not ok 10 should be equal
  ---
    operator: equal
    expected: |-
      'This is a test.\r\n\r\nSome text to start.\r\n\r\n    \\\\\r\n    One child.\r\n    \r\n\r\n    \\\\\r\n    Two children.\r\n    \r\n\r\nMore text.\r\n'
    actual: |-
      'This is a test.\r\n\r\nSome text to start.\n\n    \\\\\n    One child.\n    \n\n    \\\\\n    Two children.\n    \n\nMore text.\r\n'
  ...
# require-markup
ok 11 null
not ok 12 should be equal
  ---
    operator: equal
    expected: |-
      'This is a parent form.\r\n\r\n    \\\\\r\n    This is a child form.\r\n    \r\n'
    actual: |-
      'This is a parent form.\r\n\r\n    \\\\\n    This is a child form.\n    \r\n'
  ...
# require-nested-with-children
ok 13 null
not ok 14 should be equal
  ---
    operator: equal
    expected: |-
      '    \\\\\r\n    This is a test.\r\n\r\n    Some text to start.\r\n\r\n        \\\\\r\n        One child.\r\n    \r\n\r\n        \\\\\r\n        Two children.\r\n    \r\n\r\n    More text.\r\n'
    actual: |-
      '    \\\\\r\n    This is a test.\r\n\r\n    Some text to start.\n\n        \\\\\n        One child.\n    \n\n        \\\\\n        Two children.\n    \n\n    More text.\r\n'
  ...
# require-project
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND projects.commonform.org projects.commonform.org:443
    at errnoException (dns.js:26:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
npm ERR! Test failed.  See above for more details.
@kemitchell
Copy link
Member

Not sure why I didn't see a notification for this back when it happened.

The test output you copied shows two issues: Windows \r\n line breaks and unsuccessful HTTP requests to projects.commonform.org. For the latter, more recent releases hit api.commonform.org, which dutifully responds.

That should also address the issue you were having running the program. I take it the code is trying to hit projects.commonform.org, getting nowhere, and still trying to read response data. Hence the error.

@kemitchell kemitchell self-assigned this Apr 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants