Skip to content

TypeError: Cannot read property 'length' of undefined at Object.DataRow #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Josehower opened this issue Dec 1, 2021 · 3 comments · Fixed by #259
Closed

TypeError: Cannot read property 'length' of undefined at Object.DataRow #250

Josehower opened this issue Dec 1, 2021 · 3 comments · Fixed by #259

Comments

@Josehower
Copy link

Josehower commented Dec 1, 2021

A weird error happened on our server that seems to reveal a bug in the library.

Is a quite uncommon error that suggests is not an implementation problem but more a library bug.

for some reason under a now unknown circumstance columns seems to be undefined here:

for (let i = 0; i < backend.query.statement.columns.length; i++) {

I am afraid that the information given may not be sufficient, but it can be an already known issue or something that may add up to another user information.

   for (let i = 0; i < backend.query.statement.columns.length; i++) {
                                                      ^
TypeError: Cannot read property 'length' of undefined    
at Object.DataRow (/opt/xxx/project/src/node_modules/postgres/lib/backend.js:113:57)    
at Socket.data (/opt/xxx/project/src/node_modules/postgres/lib/connection.js:319:25)    
at Socket.emit (node:events:365:28)    
at addChunk (node:internal/streams/readable:314:12)    
at readableAddChunk (node:internal/streams/readable:289:9)    
at Socket.Readable.push (node:internal/streams/readable:228:10)    
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
error Command failed with exit code 1.

thanks

@porsager
Copy link
Owner

porsager commented Dec 1, 2021

Hi @Josehower .

Yes, that indeed looks like an issue inside Postgres.js. Thanks for reporting. Do you know if this happened during a shutdown of the database?

@Josehower
Copy link
Author

It's not clear to me what a shutdown Means. But I can see the database Was up and running at the moment of the issue and keep working also after that.

The express Server also didn't crashed.

@porsager
Copy link
Owner

porsager commented Dec 1, 2021

I meant if the database itself was maybe shutting down / restarting / closing the connection to the client at the time. I'll dig in to see if I can find a reason for this error.

@porsager porsager mentioned this issue Jan 11, 2022
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants