Error with imagebuilder.createImageRecipe() due to incorrect constructor definition
See original GitHub issueConfirm by changing [ ] to [x] below to ensure that it’s a bug:
- I’ve gone though Developer Guide and API reference
- I’ve checked AWS Forums and StackOverflow for answers
- I’ve searched for previous similar issues and didn’t find any solution
Describe the bug
It appears that the constructor for the imagebuilder.createImageRecipe() is incorrect in the aws-sdk for javascript, which causes an error when calling this method.
SDK Documentation for : https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Imagebuilder.html#createImageRecipe-property
VSCode seems to indicate this may be a problem with the constructor for this method needing a clientToken but not having one:
Argument of type '{ components: { componentArn: string; }[]; name: string; parentImage: string; semanticVersion: string; }' is not assignable to parameter of type 'CreateImageRecipeRequest'.
Property 'clientToken' is missing in type '{ components: { componentArn: string; }[]; name: string; parentImage: string; semanticVersion: string; }' but required in type 'CreateImageRecipeRequest'.ts(2345)
imagebuilder.d.ts(742, 5): 'clientToken' is declared here.
Is the issue in the browser/Node.js? Node.js
If on Node.js, are you running this on AWS Lambda? Yes
Details of the browser/Node.js version 12.14.1
SDK version number v2.602.0
To Reproduce (observed behavior)
const AWS = require("aws-sdk");
const imagebuilder = new AWS.Imagebuilder({region: 'us-west-2'});
var params = {
components: [
{
componentArn: 'arn:aws:imagebuilder:us-west-2:aws:component/php-7-3-linux/1.0.0'
},
],
name: 'TestRecipe',
parentImage: 'arn:aws:imagebuilder:us-west-2:aws:image/amazon-linux-2-x86/2020.1.8',
semanticVersion: '1.0.0',
};
imagebuilder.createImageRecipe(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Produces generic error in log/traceback:
{
"errorType": "ServiceException",
"errorMessage": "An internal error occurred while processing your request.",
"trace": [
"ServiceException: An internal error occurred while processing your request.",
" at Object.extractError (/var/task/node_modules/aws-sdk/lib/protocol/json.js:51:27)",
" at Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/rest_json.js:55:8)",
" at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:106:20)",
" at Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:78:10)",
" at Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:683:14)",
" at Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)",
" at AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)",
" at /var/task/node_modules/aws-sdk/lib/state_machine.js:26:10",
" at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)",
" at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:685:12)"
]
}
Expected behavior Successful sdk response as defined in https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Imagebuilder.html#createImageRecipe-property
Additional context
Replacing the method with another method for example: imagebuilder.listImagePipelines()
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Imagebuilder.html#listImagePipelines-property
Works fine so this issue seems to be isolated to the imagebuilder.createImageRecipe()
method
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
As you confirmed this issue is with the Lambda environment and not an issue with the aws-sdk. I have opened a case with AWS support and I am closing this issue.
Thank you for your assistance in troubleshooting!
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.