hapijs / joi

The most powerful data validation library for JS
Other
20.91k stars 1.51k forks source link

TypeError: Cannot read property 'length' of undefined #1155

Closed rokoroku closed 7 years ago

rokoroku commented 7 years ago

Context

What are you trying to achieve or the steps to reproduce ?

Didn't found the exact reason, since stacktrace doesn't show the source location. I'll update this issue if I found some relevant reason.

Which result you had?

  TypeError: Cannot read property 'length' of undefined​​
    ​​    at Object.toString (/.../node_modules/joi/lib/errors.js:100:31)​​
    ​​    at Object.internals.stringify (/.../node_modules/hapi/node_modules/joi/lib/errors.js:40:22)​​
    ​​    at Object.internals.stringify (/.../node_modules/hapi/node_modules/joi/lib/errors.js:34:78)​​
    ​​    at format.replace (/.../node_modules/hapi/node_modules/joi/lib/errors.js:90:42)​​
    ​​    at RegExp.[Symbol.replace] (native)​​
    ​​    at String.replace (native)​​
    ​​    at Object.toString (/.../node_modules/hapi/node_modules/joi/lib/errors.js:87:23)​​
    ​​    at processErrors (/.../node_modules/hapi/node_modules/joi/lib/errors.js:126:36)​​
    ​​    at Object.exports.process (/.../node_modules/hapi/node_modules/joi/lib/errors.js:149:22)​​
    ​​    at Object._validateWithOptions (/.../node_modules/hapi/node_modules/joi/lib/any.js:607:31)​​
    ​​    at Object.root.validate (/.../node_modules/hapi/node_modules/joi/lib/index.js:121:23)​​
    ​​    at Object.internals.input (/.../node_modules/hapi/lib/validation.js:137:20)​​
    ​​    at exports.params (/.../node_modules/hapi/lib/validation.js:48:22)​​
    ​​    at each (/.../node_modules/hapi/lib/request.js:382:16)​​
    ​​    at iterate (/.../node_modules/hapi/node_modules/items/lib/index.js:36:13)​​
    ​​    at done (/.../node_modules/hapi/node_modules/items/lib/index.js:28:25)​​
    ​​    at internals.Auth.payload (/.../node_modules/hapi/lib/auth.js:242:16)​​
    ​​    at each (/.../node_modules/hapi/lib/request.js:382:16)​​
    ​​    at iterate (/.../node_modules/hapi/node_modules/items/lib/index.js:36:13)​​
    ​​    at done (/.../node_modules/hapi/node_modules/items/lib/index.js:28:25)​​
    ​​    at onParsed (/.../node_modules/hapi/lib/route.js:407:20)​​
    ​​    at Subtext.parse (/.../node_modules/hapi/lib/route.js:428:20)​​
    ​​    at next (/.../node_modules/hapi/node_modules/subtext/lib/index.js:45:26)​​
    ​​    at internals.object (/.../node_modules/hapi/node_modules/subtext/lib/index.js:171:20)​​
    ​​    at Object.internals.jsonParse (/.../node_modules/hapi/node_modules/subtext/lib/index.js:279:16)​​
    ​​    at Object.internals.object (/.../node_modules/hapi/node_modules/subtext/lib/index.js:263:26)​​
    ​​    at Wreck.read (/.../node_modules/hapi/node_modules/subtext/lib/index.js:163:19)​​
    ​​    at finish (/.../node_modules/hapi/node_modules/wreck/lib/index.js:344:20)​​
    ​​    at wrapped (/.../node_modules/hapi/node_modules/hoek/lib/index.js:871:20)​​
    ​​    at module.exports.internals.Recorder.onReaderFinish (/.../node_modules/hapi/node_modules/wreck/lib/index.js:415:16)​​
    ​​    at Object.onceWrapper (events.js:290:19)​​
    ​​    at emitNone (events.js:91:20)​​
    ​​    at module.exports.internals.Recorder.emit (events.js:185:7)​​
    ​​    at finishMaybe (_stream_writable.js:513:14)​​
    ​​    at endWritable (_stream_writable.js:523:3)​​
    ​​    at module.exports.internals.Recorder.Writable.end (_stream_writable.js:488:5)​​
    ​​    at module.exports.internals.Request.onend (_stream_readable.js:511:10)​​
    ​​    at Object.onceWrapper (events.js:290:19)​​
    ​​    at emitNone (events.js:91:20)​​
    ​​    at module.exports.internals.Request.emit (events.js:185:7)​​
    ​​    at endReadableNT (_stream_readable.js:974:12)​​
    ​​    at _combinedTickCallback (internal/process/next_tick.js:74:11)​​
    ​​    at process._tickDomainCallback (internal/process/next_tick.js:122:9)​​

What did you expect ?

Marsup commented 7 years ago

I'm going to guess you're using extensions that are making use of undeclared language error codes.

rokoroku commented 7 years ago

OK, I use some extension, and I think maybe that causes some exception. I'll close this.