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.

TypeError: Cannot read property 'toString' of null

See original GitHub issue

I have a bunch of “seed” files that populate development and test dbs. One file in particular has about 550 seed lines, each about 2k characters long (inline maps with string keys, hash rockets, and values).

If I run prettier over it, it errors with:

[error] db/seeds/categories.seeds.rb: TypeError: Cannot read property 'toString' of null
[error]     at Object.module.exports [as parse] (/Users/noah/dev/ebth-com/node_modules/@prettier/plugin-ruby/src/parse.js:7:30)
[error]     at Object.parse$2 [as parse] (/Users/noah/dev/ebth-com/node_modules/prettier/bin-prettier.js:10641:19)
[error]     at coreFormat (/Users/noah/dev/ebth-com/node_modules/prettier/bin-prettier.js:13858:23)
[error]     at format (/Users/noah/dev/ebth-com/node_modules/prettier/bin-prettier.js:14117:73)
[error]     at formatWithCursor (/Users/noah/dev/ebth-com/node_modules/prettier/bin-prettier.js:14133:12)
[error]     at Object.formatWithCursor (/Users/noah/dev/ebth-com/node_modules/prettier/bin-prettier.js:42401:15)
[error]     at format$1 (/Users/noah/dev/ebth-com/node_modules/prettier/bin-prettier.js:43770:21)
[error]     at /Users/noah/dev/ebth-com/node_modules/prettier/bin-prettier.js:43965:16
[error]     at /Users/noah/dev/ebth-com/node_modules/prettier/bin-prettier.js:43905:14
[error]     at Array.forEach (<anonymous>)

If I cut it up at all (in an attempt to binary-search which lines it chokes on), prettier returns correct file, which makes me think it’s about the size of the hashes or the size of the call and not something inside the hash.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kddnewtoncommented, Feb 11, 2019

Wow this is really great thanks for the report! So this has actually exposed a bug wherein we were passing the content of the file to be parsed as an argument to a spawned process, whereas we should have been writing it to stdin. The size of your file hit the E2BIG error from node and was even breaking out error handling. The referenced PR fixes this, and I’ll push up a new version later today with the fix (will end up being v0.3.8).

0reactions
kddnewtoncommented, Feb 12, 2019

Actually this ended up being v0.4.0 because I bundled it with another change. It’s now out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'toString' of null
So whenever you try to access a property under a value of null or undefined in JavaScript and try to read any property,...
Read more >
TypeError: Cannot read property 'toString' of null #304 - GitHub
The issue is that the default value of id is null and the IdFixer component is broken, as it accesses toString of null....
Read more >
TypeError: Cannot read property 'toString' of null - Help
What seems to be the problem: I am getting a JavaScript error on date field <input class="form-control" data-inputmask-alias="datetime" ...
Read more >
TypeError: Cannot read property 'toString' of null
TypeError : Cannot read property 'toString' of null ... Description of the problem: Hello, when I try to run my experiment on pavlovia...
Read more >
Autocomplete Cannot read property 'toString' of null - Syncfusion
Autocomplete Cannot read property 'toString' of null · Hi Robert, · A support incident to track the status of this defect has been...
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