Skip to content

Compile errors @aws-crypto/material-management with @types/node >= 16.0.2 #722

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
cernytomas opened this issue Aug 31, 2021 · 3 comments
Closed

Comments

@cernytomas
Copy link
Contributor

Problem:

Cannot build Typescript project using @aws-crypto/material-management and @types/node >= 16.0.2

node_modules/@aws-crypto/material-management-node/build/main/src/material_helpers.d.ts:3:10 - error TS2724: '"crypto"' has no exported member named 'Signer'. Did you mean 'Sign'?

3 import { Signer, Verify, createCipheriv, createDecipheriv } from 'crypto';
           ~~~~~~

  node_modules/@types/node/crypto.d.ts:1265:11
    1265     class Sign extends stream.Writable {
                   ~~~~
    'Sign' is declared here.

Solution:

This issue is due to wrong type definition of crypto Sign class (previously Signer) fixed in DefinitelyTyped/DefinitelyTyped#54394
released with @types/[email protected]

Update @types/node to version 16.0.2 or higher
Rename Signer to Sign

This solution will be breaking change for developers using @types/node < 16.0.2

@tomasstrejcek
Copy link

This can probably be closed then? :)

@sandfox
Copy link

sandfox commented Oct 26, 2021

Seeing (what I think is the same error) using typescript 4.4.4 and the currrent latest version of the library 3.0.3 and node v14.18.1 / 16.12.0

npm install @aws-crypto/client-node@^3.0.3

index.js

import { NodeMaterialsManager } from '@aws-crypto/client-node'
tsc --noEmit --allowJS --checkJs index.js
 
node_modules/@aws-crypto/material-management-node/build/main/src/material_helpers.d.ts:3:10 - error TS2724: '"crypto"' has no exported member named 'Signer'. Did you mean 'Sign'?

3 import { Signer, Verify, createCipheriv, createDecipheriv } from 'crypto';
           ~~~~~~

  node_modules/@types/node/crypto.d.ts:1320:11
    1320     class Sign extends stream.Writable {
                   ~~~~
    'Sign' is declared here.


Found 1 error.

interesting/weirdly - installing (downgrading) to @types/node < 16.0.2 makes the problem go away

npm install @types/[email protected]

@texastony
Copy link
Contributor

Howdy @sandfox , @tomasstrejcek , @cernytomas

The latest release of the ESDK-JavaScript supports Node 16.
If there are still problems with using our library with @types/node >= 16, please re-open or create a new issue.

Much Obliged,
AWS Crypto Tools

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

4 participants