question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with imagebuilder.createImageRecipe() due to incorrect constructor definition

See original GitHub issue

Confirm by changing [ ] to [x] below to ensure that it’s a bug:

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:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JKCTcommented, Jan 17, 2020

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!

0reactions
lock[bot]commented, Jan 24, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CreateImageRecipe - EC2 Image Builder - AWS Documentation
Creates a new image recipe. Image recipes define how images are configured, tested, and assessed.
Read more >
create-image-recipe — AWS CLI 2.9.9 Command Reference
Image recipes define how images are configured, tested, and assessed. ... Image Builder automatically assigns the build number to the fourth node.
Read more >
Apropos eb - FreeBSD
A simple-to-use, lightweight web CGI framework It is primarily a glue between HTML::Template, CGI::Session, CGI, Locale::Maketext and some magic :) CPAN::Debug( ...
Read more >
Automating Images in the cloud with EC2 Image Builder
Sponsored session by AWS at the 2021 PowerShell + DevOps Global Summit.
Read more >
EC2 Image Builder: Build your golden VM images on AWS
Components—Components are software scripts that define the custom configuration of an image. Components cannot be modified or replaced after a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found