aws-sdk-js-v3
aws-sdk-js-v3 copied to clipboard
S3Control.createJob - attempts to throw exception, but results in a deserializer error
Describe the bug
Calling S3Control.createJob()
results in an internal error (see below).
SDK version number 3.0.0
Is the issue in the browser/Node.js/ReactNative? Node.js
Details of the browser/Node.js/ReactNative version v12.18.3
To Reproduce (observed behavior)
const data = await s3Control.createJob({
AccountId: process.env.ACCOUNT_ID,
ConfirmationRequired: false,
Manifest: {
Location: {
ETag: manifest.eTag,
ObjectArn: `arn:aws:s3:::${manifest.bucket}/${manifest.key}`,
},
Spec: {
Format: 'S3BatchOperations_CSV_20180820',
Fields: ['Bucket', 'Key'],
},
},
Operation: {
LambdaInvoke: {
FunctionArn: process.env.BATCH_FUNC_ARN,
},
},
Priority: 1,
Report: {
Bucket: manifest.bucket,
Enabled: true,
Prefix: 'reports/',
ReportScope: 'AllTasks',
Format: 'Report_CSV_20180820',
},
RoleArn: process.env.BATCH_ROLE_ARN,
});
Expected behavior If I'm doing something wrong, the error should clearly state that. However, it looks like there's an internal mistake in the library that's throwing an error.
Additional context
{
"errorType": "TypeError",
"errorMessage": "Cannot read property 'Code' of undefined",
"$metadata": {
"attempts": 1,
"totalRetryDelay": 0
},
"stack": [
"TypeError: Cannot read property 'Code' of undefined",
" at loadRestXmlErrorCode (/var/task/node_modules/@aws-sdk/client-s3-control/protocols/Aws_restXml.ts:6788:18)",
" at deserializeAws_restXmlCreateJobCommandError (/var/task/node_modules/@aws-sdk/client-s3-control/protocols/Aws_restXml.ts:2061:15)",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)",
" at /var/task/node_modules/@aws-sdk/middleware-serde/src/deserializerMiddleware.ts:23:18",
" at /var/task/node_modules/@aws-sdk/middleware-signing/src/middleware.ts:26:22",
" at StandardRetryStrategy.retry (/var/task/node_modules/@aws-sdk/middleware-retry/src/defaultStrategy.ts:118:38)",
" at data (/var/task/node_modules/@aws-sdk/middleware-logger/src/loggerMiddleware.ts:21:20)",
" at Runtime.n [as handler] (/var/task/src/lambda/webpack:/v2-migrate-user/src/lambda/start-audio-file-migration.ts:11:9)"
]
}
Hi @ffxsam
Thank you for reporting this. The root cause of the problem is that the Error
is not defined here. We can potentially use optional chaining to make it not throwing when Error
is not defined. We also need to investigate why it is not defined because it breaks the contract.
Any movement on this? It's been nearly a year.
I think this issue might be the same issue as https://github.com/aws/aws-sdk-js-v3/issues/2861
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.