question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UnhandledPromiseRejectionWarning: TypeError: Cannot convert object to primitive value

See original GitHub issue

What did you do

Running as NPM script: jsonschema2md -o docs/ -x docs/ -d schemas/ -e json

What did you expect to happen

No warnings of unhandled promise rejections.

What happened

Note: I reference unloaded JSON schemas of another project.

(node:23354) UnhandledPromiseRejectionWarning: TypeError: Cannot convert object to primitive value
    at makeconstraintssection (/Users/axawinterthur/dev/aletheia/node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:590:33)
    at Object.entries.map (/Users/axawinterthur/dev/aletheia/node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:715:14)
    at Array.map (<anonymous>)
    at makeproplist (/Users/axawinterthur/dev/aletheia/node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:705:54)
    at makeproperties (/Users/axawinterthur/dev/aletheia/node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:819:12)
    at foldl (/Users/axawinterthur/dev/aletheia/node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:843:10)
    at each (/Users/axawinterthur/dev/aletheia/node_modules/ferrum/src/sequence.js:984:12)
    at curry (/Users/axawinterthur/dev/aletheia/node_modules/ferrum/src/sequence.js:582:5)
    at each [CURRY] (/Users/axawinterthur/dev/aletheia/node_modules/ferrum/src/functional.js:169:12)
    at curry (/Users/axawinterthur/dev/aletheia/node_modules/ferrum/src/sequence.js:983:3)
(node:23354) 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:23354) [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.

What’s your environment

  • Operating System: macOS Catalina 10.15.2 (19C57)
  • node.js version: v10.15.0

Do you have example files:

Sorry, not publicly available for this.

I have the full log only:

> jsonschema2md -o docs/ -x docs/ -d schemas/ -e json

loading 53 schemas
cannot resolve http://jsonlogic.com/schemas/json-logic.json
cannot resolve http://jsonlogic.com/schemas/json-logic.json
writing schemas
writing schemas to .../docs
writing README
building readme
writing documentation
generating markdown
(node:23354) UnhandledPromiseRejectionWarning: TypeError: Cannot convert object to primitive value
    at makeconstraintssection (.../node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:590:33)
    at Object.entries.map (.../node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:715:14)
    at Array.map (<anonymous>)
    at makeproplist (.../node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:705:54)
    at makeproperties (.../node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:819:12)
    at foldl (.../node_modules/@adobe/jsonschema2md/lib/markdownBuilder.js:843:10)
    at each (.../node_modules/ferrum/src/sequence.js:984:12)
    at curry (.../node_modules/ferrum/src/sequence.js:582:5)
    at each [CURRY] (.../node_modules/ferrum/src/functional.js:169:12)
    at curry (.../node_modules/ferrum/src/sequence.js:983:3)
(node:23354) 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:23354) [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.
.../docs/README.md created

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
trieloffcommented, Jan 14, 2020

Yes, that’s exactly what’s happening. I can fix this.

0reactions
AndyOGocommented, Jan 14, 2020

@trieloff Thanks again for your quick help.

I have more output now, though another unhandled promise rejection. We use other keywords as keys too, e.g. object type properties or array type items keywords, but those are all not primitives… 🤔

(node:26127) UnhandledPromiseRejectionWarning: TypeError: Cannot convert object to primitive value
    at String (<anonymous>)
    at longestStreak (/Users/axawinterthur/dev/aletheia/node_modules/longest-streak/index.js:16:11)
    at Of.inlineCode (/Users/axawinterthur/dev/aletheia/node_modules/remark-stringify/lib/visitors/inline-code.js:30:39)
    at Of.one [as visit] (/Users/axawinterthur/dev/aletheia/node_modules/remark-stringify/lib/macro/one.js:19:30)
    at Of.all (/Users/axawinterthur/dev/aletheia/node_modules/remark-stringify/lib/macro/all.js:14:27)
    at Of.tableCell (/Users/axawinterthur/dev/aletheia/node_modules/remark-stringify/lib/visitors/table-cell.js:8:15)
    at Of.one [as visit] (/Users/axawinterthur/dev/aletheia/node_modules/remark-stringify/lib/macro/one.js:19:30)
    at Of.all (/Users/axawinterthur/dev/aletheia/node_modules/remark-stringify/lib/macro/all.js:14:27)
    at Of.table (/Users/axawinterthur/dev/aletheia/node_modules/remark-stringify/lib/visitors/table.js:44:26)
    at Of.one [as visit] (/Users/axawinterthur/dev/aletheia/node_modules/remark-stringify/lib/macro/one.js:19:30)
(node:26127) 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:26127) [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.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot convert object to primitive value - Stack Overflow
most of the Javascript objects have toString() method inherited from Object.prototype . but some of them that have a null prototype , not...
Read more >
Uncaught TypeError: Cannot convert object to primitive value ...
I'm seeing the following error upgrading from 2.9 to 2.11.0: Uncaught TypeError: Cannot convert object to primitive value toString is being ...
Read more >
Cannot convert object to primitive value | The Node.js Master ...
Your browser can't play this video. ... Bonus Lecture - TypeError : Cannot convert object to primitive value | The Node.js Master Class....
Read more >
error typeerror: cannot convert object to primitive value
What's causing this error-message in general is that the system tries to convert some object to a string but can not produce a...
Read more >
Cannot convert object to primitive value with imported ... - Morioh
I'm trying to dynamically build a vuetify component in a nuxt project (Using different text values with vuetify component) by importing and iterating...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found