aws / aws/aws-encryption-sdk-javascript
Compile error in modules/example-node/src/kms_filtered_discovery.ts
- Vorherrschende Sprache
- TypeScript
- Sterne
- 260
- Forks
- 68
- Ø Merge
- 22 Std. 19 Min.
- Gemergte PRs (30 T.)
- 2
Beschreibung
### Problem:
Attempting to compile the example code in "modules/example-node/src/kms_filtered_discovery.ts" results in a Typescript compile error:
```
Type 'KmsClientSupplier' is not assignable to type 'KmsClientSupplier'.
Type 'KMS' is not assignable to type 'AwsEsdkKMSInterface'.
The types returned by 'decrypt(...)' are incompatible between these types.
Type 'Promise' is not assignable to type 'Promise | AwsSdkV2Response'.
Type 'Promise' is not assignable to type 'Promise'.
Type 'DecryptCommandOutput' is not assignable to type 'DecryptResponse' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'KeyId' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
```
The problem goes away if you comment out line 38:
```
const keyring = new KmsKeyringNode({
// clientProvider,
discovery,
discoveryFilter,
})
```
But this is not a real solution, because what I actually want is to limit the AWS regions, which is achieved using the following on line 29:
```
const clientProvider = limitRegions(['ap-southeast-2'], getKmsClient)
```
Beitragsleitfaden
Rechercherichtung
Beginne mit modules/example-node/src/kms_filtered_discovery.ts, insbesondere mit der clientProvider-Deklaration in Zeile 29 und der KmsKeyringNode-Konstruktion in Zeile 38. Reproduziere den TypeScript-Kompilierungsfehler und untersuche anschließend die beteiligten KMS-Client- und Keyring-Typen; als erledigt gilt die Aufgabe, wenn das Beispiel kompiliert und dabei die Beschränkung auf die Region ap-southeast-2 beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- aws, node.js, typescript
- Bereich
- backend, cloud, security
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100