The Wayback Machine - https://web.archive.org/web/20200601110746/https://github.com/NodeRedis/node-redis/issues/1369
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

Add trace to 'Deprecated' message #1369

Open
sunny-lan opened this issue Aug 18, 2018 · 5 comments
Open

Add trace to 'Deprecated' message #1369

sunny-lan opened this issue Aug 18, 2018 · 5 comments
Milestone

Comments

@sunny-lan
Copy link

@sunny-lan sunny-lan commented Aug 18, 2018

Feature request:

When it shows a message like:

node_redis: Deprecated: The HGET command contains a "null" argument.
This is converted to a "null" string now and will return an error from v.3.0 on.
Please handle this in your code to make sure everything works as you intended it to.

It is hard to find where the issue is coming from. It would be useful to have a stack trace generated every time this happens. Especially if the dev has no choice over what redis version is used.

@stockholmux
Copy link
Member

@stockholmux stockholmux commented Aug 20, 2018

This a reasonable request. Could be integrated with RedisClient.prototype.warn as a one-liner by using console.trace. The only trick would be it would only be listed in the terminal, not from someone listening for errors, but that seems like it's ok.

@sunny-lan
Copy link
Author

@sunny-lan sunny-lan commented Aug 20, 2018

Wouldn't the console.trace have to be put outside of nextTick? I think a sketchy way to do it would be

const trace=new Error(msg);
process.nextTick(function () {
 if(...) {
   self.emit('warning',trace);
 } else {
   console.warn(trace);
 }
});

I can do a PR if thats ok

@stockholmux
Copy link
Member

@stockholmux stockholmux commented Aug 20, 2018

Good point. I think it would still tell you the location but it wouldn't be at the top level of the trace. Need to think on it, but if you have a suggestion, let's hear it.

@ad34
Copy link

@ad34 ad34 commented Nov 12, 2018

+1 on this. sometimes it s tricky to find the code leading to this warning.

@1blockologist
Copy link

@1blockologist 1blockologist commented Feb 3, 2019

Yes, or a way to disable these deprecation warnings on production, a real crash will produce a stack trace anyway if an upgraded version ever actually comes out!

These messages fill up my server logs!

@Salakar Salakar added this to the v3.0.0 milestone Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants
You can’t perform that action at this time.