Skip to content
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

TypeError: Cannot read property 'write' of null at Zlib.callback (zlib.js:499:33) for Nodejs 14.5 #3397

Closed
naren0021 opened this issue Jun 3, 2021 · 11 comments
Labels

Comments

@naren0021
Copy link

I have recently experienced the issue on node 14.x on the production


uncaughtException: Cannot read property 'write' of null
TypeError: Cannot read property 'write' of null
    at Zlib.callback (zlib.js:499:33)
@Ayase-252
Copy link
Member

Could you provide a minimal repro? Can you reproduce this in latest LTS v14.17 or Current v16.3?

@aduh95 aduh95 transferred this issue from nodejs/node Jun 3, 2021
@aduh95
Copy link

aduh95 commented Jun 3, 2021

Hi @naren0021, from what I can see of the error stack you copied (BTW, it's usually better to copy the whole output if you want someone to help you to have the correct info), it seems you have a module called zlib.js which has a bug on line 499: it tries to read a property of an object which is in fact null. It should look something like that:

   myObject.write('data');

It either means that you need to add a check before trying to call the method:

  if (myObject != null) myObject.write('data');

Or that there's somewhere else in your app, in which case there's not much I can do to help you...

I see in the issue title that you are using Node.js 14.5, kindly consider upgrading to the latest version, lots of bugs are fixed simply by keeping up-to-date with the tools you're using.

@naren0021
Copy link
Author

correct error is this @Ayase-252

     at Zlib.callback (zlib.js:499:33)
    TypeError: Cannot read property 'write' of null
    at Zlib.callback (zlib.js:499:33)
   TypeError: Cannot read property 'write' of null
    at Zlib.callback (zlib.js:499:33)
   TypeError: Cannot read property 'write' of null
   at Zlib.callback (zlib.js:499:33)
   TypeError: Cannot read property 'write' of null
   at Zlib.callback (zlib.js:499:33)
   TypeError: Cannot read property 'write' of null
   at Zlib.callback (zlib.js:499:33)
   TypeError: Cannot read property 'write' of null
   at Zlib.callback (zlib.js:499:33)
   TypeError: Cannot read property 'write' of null
   at Zlib.callback (zlib.js:499:33)

yes sure I will update the Node version and will update you @aduh95

@bl-ue
Copy link

bl-ue commented Jun 6, 2021

@aduh95 this looks like a case of nodejs/node#36421 :(

@KRAUS1203
Copy link

This issue is not as simple as since Zlib is a submodule of core node js and is used internally when web sockets are used. so if we write something on websocket i.e. socket.emit we dont have access to zlib. so cannot do the check mentioned by @aduh95 .
also this is when socket connection is closed by client side while server is writing something.

@aduh95
Copy link

aduh95 commented Jun 7, 2021

@KRAUS1203 I didn't realize zlib.js was referring to a core module, thanks for pointing it out – stack traces in Node.js v15+ would refer to it as node:zlib to remove the ambiguity, I forgot v14.x still has the old style ones.

Line 499 of zlib.js is an empty line in v14.5.0: https://github.com/nodejs/node/blob/v14.5.0/lib/zlib.js#L499
@naren0021 are you using a modified version of Node.js?

@bl-ue
Copy link

bl-ue commented Jun 7, 2021

@naren0021 are you using a modified version of Node.js?

I wouldn't think so — you can see in nodejs/node#36421 that three different people have the same line (499).

@bl-ue
Copy link

bl-ue commented Jun 7, 2021

@bl-ue
Copy link

bl-ue commented Jun 7, 2021

@naren0021 you said:

on node 14.x on the production

but this appears to be like @KRAUS1203's problem, and in nodejs/node#36421 they said that they were using 8.9.4 🤔

Copy link

github-actions bot commented May 9, 2024

It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment.
If you need further assistance or have questions, you can also search for similar issues on Stack Overflow.
Make sure to look at the README file for the most updated links.

@github-actions github-actions bot added the stale label May 9, 2024
Copy link

github-actions bot commented Jun 9, 2024

It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment.
If you need further assistance or have questions, you can also search for similar issues on Stack Overflow.
Make sure to look at the README file for the most updated links.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants