Aws-sdk-js: Can't use typescript >3.5.3 with aws-sdk

Created on 8 Aug 2020  路  2Comments  路  Source: aws/aws-sdk-js

It would seem the EventMessageChunkerStream constructor isn't compatible with the Transform constructor, and that's resulting in this Error: Debug Failure. False expression. error from ts-loader in this issue created for thets-loader` project.
https://github.com/aws/aws-sdk-js/blob/fa6d7c2c4f8470fa022f061d09cf6f1187037013/lib/event-stream/event-message-chunker-stream.js#L5-L18

Quoting the original issue below (https://github.com/TypeStrong/ts-loader/issues/1099):

Expected Behaviour

Attempting to webpack my project, I expect that unless I've got typings errors, should compile-- or at least return those typings errors.

Actual Behaviour

An error message from typescript attempting to compile via ts-loader: Error: Debug Failure. False expression.

I'm only able to use TypeScript <= 3.5.3, but have attempted with each release .. even 3.9.0 and 4.0.0 builds.

Steps to Reproduce the Problem

  1. Create a project with ts-loader, typescript > 3.5.3, and aws-sdk S3 client
  2. Try to build via webpack

Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/gvanderest/ts-loader-aws-sdk-issue

Instructions in the README.

Error Message

ERROR in ./node_modules/aws-sdk/lib/event-stream/event-message-chunker-stream.js
Module build failed (from ./node_modules/ts-loader/index.js):
Error: Debug Failure. False expression.
    at getConstructorDefinedThisAssignmentTypes (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:40859:22)
    at getWidenedTypeForAssignmentDeclaration (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:40734:63)
    at getTypeOfVariableOrParameterOrPropertyWorker (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:41067:24)
    at getTypeOfVariableOrParameterOrProperty (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:41015:28)
    at getTypeOfSymbol (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:41339:24)
    at checkPropertyAccessExpressionOrQualifiedName (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:55698:53)
    at checkPropertyAccessExpression (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:55557:17)
    at checkExpressionWorker (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:60102:28)
    at checkExpression (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:60023:38)
    at checkPrefixUnaryExpression (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:58791:31)
    at checkExpressionWorker (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:60139:28)
    at checkExpression (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:60023:38)
    at checkTruthinessExpression (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:62523:42)
    at checkIfStatement (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:62454:24)
    at checkSourceElementWorker (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:64920:28)
    at checkSourceElement (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:64800:17)
    at Object.forEach (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:317:30)
    at checkBlock (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:62090:20)
    at checkSourceElementWorker (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:64914:28)
    at checkSourceElement (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:64800:17)
    at checkWhileStatement (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:62514:13)
    at checkSourceElementWorker (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:64924:28)
    at checkSourceElement (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:64800:17)
    at Object.forEach (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:317:30)
    at checkBlock (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:62086:20)
    at checkSourceElementWorker (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:64914:28)
    at checkSourceElement (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:64800:17)
    at checkFunctionExpressionOrObjectLiteralMethodDeferred (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:58581:21)
    at checkDeferredNode (/Volumes/workplace/ts-loader-aws-sdk-error/node_modules/typescript/lib/typescript.js:65071:21)
    at Map.forEach (<anonymous>)
 @ ./node_modules/aws-sdk/lib/event-stream/streaming-create-event-stream.js 8:32-87
 @ ./node_modules/aws-sdk/lib/node_loader.js
 @ ./node_modules/aws-sdk/clients/s3.js
 @ ./index.ts
guidance

All 2 comments

Hey @OlenDavis thank-you for reaching out to us with your issue and apologies for late reply.

Unfortunately for AWS-SDK-V2 it is recommended to use typeScript v2.x as mentioned in the docs.

To use the latest version of the typeScript you can try our AWS-SDK-JS-V3 which is compatible with newer version of typeScript.

Closing this issue now as it has been fixed in V3 of the SDK. Please reach out if you have any other questions.

aws-sdk V3 has not arrived its public release yet. And small differences still exist (in my use case, I could not create an private IVS channel with @aws-sdk/client-ivs": "^1.0.0-gamma.0", as in SDK-V2)

Any workaround to use SDK v2 with non-ancient tsc ?

Was this page helpful?
0 / 5 - 0 ratings