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 '1' of null

See original GitHub issue

Trying to bootstrap my Node application, getting the following error, don’t know how to proceed:

TypeError: Cannot read property '1' of null
/home/vcap/app/node_modules/knex/lib/dialects/postgres/index.js:128
 at emitOne (events.js:95:20)
 at Socket.<anonymous> (/home/vcap/app/node_modules/pg/lib/connection.js:109:12)
 at emitOne (events.js:90:13)
 resolver(/^PostgreSQL (.*?)( |$)/.exec(resp.rows[0].version)[1]);
 ^
 at Socket.emit (events.js:182:7)
 at readableAddChunk (_stream_readable.js:153:18)
 at Socket.Readable.push (_stream_readable.js:111:10)
 at TCP.onread (net.js:534:20)
 at null.<anonymous> (/home/vcap/app/node_modules/pg/lib/client.js:163:19)
 at Query.handleReadyForQuery (/home/vcap/app/node_modules/pg/lib/query.js:89:10)
 at null.callback (/home/vcap/app/node_modules/knex/lib/dialects/postgres/index.js:128:69)
 at emit (events.js:182:7)
npm ERR! Linux 3.19.0-33-generic
npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
thesunnycommented, Nov 3, 2022

The fix is to change client: 'pg' to client: 'cockroachdb' and it doesn’t feel like it should work because you haven’t installed a cockroachdb specific driver (just the pg one), but it does work.

I just tried it out and it worked.

1reaction
ThanhHuuTrancommented, Aug 5, 2020

I encounter this issue while using enterpriseDB: https://www.enterprisedb.com/ query “select versions()” return “EnterpriseDB 9.6.18.25 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit” therefore the regex "/^PostgreSQL (.*?)( |$)/.exec(resp.rows[0].version)" return null in this case

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property '1' of null(…) in a JavaScript function
Uncaught TypeError: Cannot read property '1' of null(…) in a JavaScript function · 2 · Pretty obvious by the error - you're trying...
Read more >
cannot read property "1" from null - Error handling - ServiceNow
Hi Team,. I have a regex to match something and if the regex doesn't find things, its returning and rest of the code...
Read more >
Cannot read property '1' of null (Example) - Treehouse
Hey, I'm having a problem I can't quite resolve, my code isn't working and I'm not able to find out why ... Cannot...
Read more >
Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >
Uncaught TypeError: Cannot read property '1' of null
The plug-in immediatly throws this error when visiting the check-out page, and does the same when details are being changed.
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