Open indunilasanka opened 4 years ago
@elorzafe is there any plan to update to aws-sdk version 3 which is tree shakeable?
@indunilasanka @pechisworks
Thanks for the feedback, I will talk to other team members to see how can we improve this.
@elorzafe can you provide an update?
Update on this?
Hey, I've started upgrading to aws-sdk v3 and aws-crypto. Please have a look here: https://github.com/awslabs/aws-mobile-appsync-sdk-js/compare/master...CasperAlant:upgrade-aws-sdk However, I'm really struggling to make any meaningful progress with the tests.
I tried reimplementing the tests using nock in aws-appsync/tests/link/complex-object-link.test.ts
test('Is run for mutations with a S3Object', done => {
const scope = nock('https://bucket.s3.region.amazonaws.com')
.put('/')
.reply(200)
const link = complexObjectLink(null);
const operation = {
query: gql`mutation { someMutation { aField } }`,
variables: {
aFile: {
bucket: 'bucket',
key: 'key',
region: 'region',
mimeType: 'mimeType',
localUri: {},
}
},
};
execute(prepareLinkForTest(link), operation).subscribe({
next: () => {
console.log("f")
expect(scope.isDone()).toBeTruthy();
console.log("g")
done();
console.log("h")
},
error: fail
});
});
but every test that expects a request to be made fails with:
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type object
at Function.from (buffer.js:232:9)
at writeBody (***/packages/aws-appsync/node_modules/@aws-sdk/node-http-handler/src/write-request-body.ts:25:28)
at OverriddenClientRequest.httpRequest.on (***/packages/aws-appsync/node_modules/@aws-sdk/node-http-handler/src/write-request-body.ts:10:7)
at OverriddenClientRequest.emit (events.js:189:13)
at Immediate.common.setImmediate (***/appsync/packages/aws-appsync/node_modules/nock/lib/intercepted_request_router.js:98:13)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
Any guidance would be appreciated.
AWS SDK for JavaScript v2 will enter maintenance mode on September 8, 2024 and reach end-of-support on September 8, 2025. For more information, check blog post at https://a.co/cUPnyil
We recommend upgrading to JS SDK v3, especially since it's modular.
AWS-AppSync SDK (javascript: version 3.0.2) contains AWS-SDK dependency ( "aws-sdk": "2.518.0"). Are there any simplified versions. This full sdk is a bit of a heavy for our applications