salesforce / tough-cookie

RFC6265 Cookies and CookieJar for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

punycode is deprecated, remove dependency

stheine opened this issue · comments

Recently I get a deprecation warning on application startup.

(node:1699815) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.

tough-cookie brings this dependency, so you should look at getting rid of it, please.

@stheine it seems like you may be using an outdated version of the package - this was fixed in v4.1.0. Please upgrade to the latest version (v4.1.3) and let us know if the issue persists.

Hm, I'm using version 4.1.3 and am getting this issue. Punycode is still showing as a dependency of tough-cookie if I run yarn why punycode.

It's a bit confusing, but there are actually two different punycode APIs that use the same name. There's the node built-in and there's the userland package. The node built-in has been deprecated since v7, although the console warning was only added in v21. The recommended replacement for the built-in API is the userland package, which, as you have seen, is what tough-cookie uses.

If you run your app using node 21 and the --trace-deprecation flag, then this will provide a stack trace pointing to where the built-in punycode is being used.

(As a bonus fun fact, name collisions like this are one of the motivations for the introduction of node: protocol imports.)

ok, thanks, I understand now, that I submitted this issue into the wrong project, as tough-cookie already uses the userland package. using the --trace-deprecation I found the correct package to ask for an update in my case.
thanks and ok to close this issue.