currently I am working with Data sync start execution Api.
I have One stack in which I am creating all the locations, Tasks, Role and I am using DataSync client with startExecutionApi to call the task in the same stack.
My code Snippet for dataSync looks something like this
const client = new DataSyncClient();
const input = {
TaskArn: TASK1.attrTaskArn
};
const command = new StartTaskExecutionCommand(input);
(async () => {
const response = await client.send(command);
})();
But I am getting below Error
const exception = new InvalidRequestException({
^
InvalidRequestException: Invalid parameter: Malformed ARN: ${Token[TOKEN.110]}.
at de_InvalidRequestExceptionRes (/codebuild/output/src4271555059/src/node_modules/@aws-sdk/client-datasync/dist-cjs/index.js:1945:21)
at de_CommandError (/codebuild/output/src4271555059/src/node_modules/@aws-sdk/client-datasync/dist-cjs/index.js:1923:19)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /codebuild/output/src4271555059/src/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
at async /codebuild/output/src4271555059/src/node_modules/@smithy/core/dist-cjs/index.js:165:18
at async /codebuild/output/src4271555059/src/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
at async /codebuild/output/src4271555059/src/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
at async /codebuild/output/src4271555059/src/lib/stacks/be-customer-migration-stack.ts:65:28 {
‘$fault’: ‘client’,
‘$metadata’: {
httpStatusCode: 400,
requestId: ‘b124d220-8350-4bc5-9cb1-219211c65fea’,
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
errorCode: ‘InvalidParameter’,
datasyncErrorCode: undefined,
__type: ‘InvalidRequestException’
}
I tried few things and I observed
If I hard code TASK1.attrTaskArn with the task arn of a previously created task and print the response It gets printed during the synth stage of my pipeline.
(Info:-> I use pipeline to deploy the stack, and not directly deploy it)
from what I have found is datasync client is not able to resolve the arn token at the time of deployment is it because both task creation being done at the same time when dataSync client is starting it’s execution?
Is there any way to do both of them in same stack?