Comments (9)
Nope, ignore my previous message, I was wrong.
If you have a project with only @aws-sdk/client-sqs v3.10.0
, then everything works.
But if you have multiple AWS packages in dependencies in different versions, then you will end up @aws-sdk/types
dependency on the top level (if using yarn) in one of those versions. With npm it will be similar. So if you have @aws-sdk/client-sqs v3.10.0
and also for example @aws-sdk/client-dynamodb v3.5.0
, then types will be incompatible for one of those.
Best what you can do is to use the same versions for all the AWS SDK dependencies.
Another solution would be to specify the @aws-sdk/types
version explicitly, in the same version as the SDK you want to test. But then you will be able to write tests only for SDK libraries in the same version.
Does it solve your problem?
from aws-sdk-client-mock.
Best what you can do is to use the same versions for all the AWS SDK dependencies.
Another solution would be to specify the @aws-sdk/types version explicitly
I had this issue -- it seems that I had multiple incompatible versions of '@aws-sdk/types'
installed, although I couldn't figure out why.
I spent quite a while trying to ensure that I had the same exact version installed of all my aws sdk clients, but it still remained.
In the end I installed @aws-sdk/types
explicitly at the same version as my aws sdk clients, which resolved this.
(Just a note in case anyone else has the same issue)
from aws-sdk-client-mock.
It didn't but it got me thinking about the types. Turns out that I didn't have the @aws-sdk/types package at all and that was causing issues. Adding that as a dev dependency fixed the problem.
Thanks! Great package by the way! Super simple to use!
from aws-sdk-client-mock.
The @aws-sdk/types
is a dependency of all AWS SDK clients, and it should be in the same version as the SDK client. Here is seems that for some reason a different version was installed - maybe some other dependency requested it? Anyway, good that it helped you solve the issue, please reopen in case of further problems with types.
Thanks! Great package by the way! Super simple to use!
Thank you, good to hear it!
from aws-sdk-client-mock.
Hey, I see the types in AWS SDK changed somewhere between 3.4.1 (when I last tested it) and 3.10.0 (the current one). I will work on the fix. Thanks for the report!
from aws-sdk-client-mock.
For me it worked by installing @aws-sdk/types in the same version of sdk packages
from aws-sdk-client-mock.
Anyone knows how could I resolve this issue when tsyringe tries to work with DynamoDBClient?
src/sensor-registry/event-publisher/handle.ts:41:28 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type 'typeof DynamoDBClient' is not assignable to parameter of type 'InjectionToken<DynamoDBClient>'.
Type 'typeof DynamoDBClient' is not assignable to type 'constructor<DynamoDBClient>'.
Types of construct signatures are incompatible.
Type 'new (...[configuration]: [] | [DynamoDBClientConfig]) => DynamoDBClient' is not assignable to type 'new (...args: any[]) => DynamoDBClient'.
Types of parameters '__0' and 'args' are incompatible.
Type 'any[]' is not assignable to type '[] | [DynamoDBClientConfig]'.
Type 'any[]' is not assignable to type '[DynamoDBClientConfig]'.
Target requires 1 element(s) but source may have fewer.
41 container.register(DynamoDBClient, {
~~~~~~~~~~~~~~
node_modules/tsyringe/dist/typings/types/dependency-container.d.ts:31:5
31 register<T>(token: InjectionToken<T>, provider: constructor<T>, options?: RegistrationOptions): DependencyContainer;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last overload is declared here.
from aws-sdk-client-mock.
Could you get a solution for this error? @florianakos ? seeing the same error after updating @aws-sdk/client-dynamodb
to 3.445.0
from aws-sdk-client-mock.
I experience similar with CognitoIdentityProviderClient. It was saying command was incompatible type using the latest in typescript.
const command = new SignUpCommand({
ClientId: await this.fetchUserPoolClientId(),
Username: username,
Password: password,
UserAttributes: [
{ Name: 'email', Value: email },
{ Name: 'nickname', Value: nickname },
{ Name: 'phone_number', Value: phone_number },
],
});
await this.cognitoClient.send(command);
After downgrading '@aws-sdk/client-cognito-identity-provider' to 3.10.0 it no longer failed for type errors.
from aws-sdk-client-mock.
Related Issues (20)
- Deprecated [email protected] library
- Solution to types not compatible with @aws-sdk/* version 3.xxx.x
- Support `toHaveReceivedAnyCommand` HOT 1
- Add repository object/homepage key to package.json HOT 2
- Fail to stub entirely QueryCommand - DynamoDB HOT 2
- Testing SDK Retries HOT 3
- Upload throws error when using mocked S3 client HOT 3
- Types is not working for aws-sdk 3.362.0 HOT 4
- AwsStub issues HOT 3
- SQSClient received matching "DeleteMessageCommand" 0 times, after "SendMessageCommand" is run HOT 1
- NodeJS 20 mocking Upload doesn't work HOT 1
- Question: how to list/print configured client beheviours? HOT 1
- calls() does not return calls made from exception handler HOT 1
- 3.1.0 / 4.0.0 breaks existing test-suite/build with Invalid Chai property: toHaveReceivedCommandWith on vitest HOT 3
- Asymmetric Matchers not working HOT 3
- Jest matcher expect().toEqual() throws error "TypeError: this.customTesters is not iterable" HOT 4
- s3 mock: You are trying to `import` a file after the Jest environment has been torn down. HOT 2
- Documentation for callsFake() should provide an example of returning Promise.reject() HOT 1
- Mocked ECSClient (using mockClient(ECSClient)) is not assignable to parameter of type 'ECSClient' HOT 10
- .toHaveReceivedCommandWith ignoring DeleteCommand and ScanCommand HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-client-mock.