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

Crypto deprecations in node 10 #2

Open
kallaspriit opened this issue Jul 11, 2018 · 3 comments
Open

Crypto deprecations in node 10 #2

kallaspriit opened this issue Jul 11, 2018 · 3 comments

Comments

@kallaspriit
Copy link

Getting deprecation warnings when used on node 10.

[DEP0091] DeprecationWarning: crypto.DEFAULT_ENCODING is deprecated.
[DEP0010] DeprecationWarning: crypto.createCredentials is deprecated. Use tls.createSecureContext instead.
[DEP0011] DeprecationWarning: crypto.Credentials is deprecated. Use tls.SecureContext instead.
@kallaspriit
Copy link
Author

Any progress/plans on this? Would a PR get merged?

@cscott
Copy link
Owner

cscott commented Aug 9, 2018 via email

@kallaspriit
Copy link
Author

I made a simple pull request but not sure if it helps as I changed the file directly not the generator.

Anyway after testing this I discovered that the actual warnings are not coming from Your library but rather from a simple import * as crypto from "crypto";, probably as it enumerates everything without even using the deprecated properties. Changing to import exactly what I need import { createHash } from "crypto"; etc fixed it.

For anyone trying to figure out where the deprecation warnings are coming from, running node with --trace-deprecation helps.

For example with Jest running node --trace-deprecation node_modules\jest\bin\jest gave me:

(node:20804) [DEP0091] DeprecationWarning: crypto.DEFAULT_ENCODING is deprecated.
    at Object.<anonymous>.__importStar (C:\xxx\index.ts:6:94)
    ...

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

No branches or pull requests

2 participants