cloudsploit icon indicating copy to clipboard operation
cloudsploit copied to clipboard

Error [TypeError]: AWS[serviceName] is not a constructor

Open ismaelalfarojr opened this issue 1 year ago • 6 comments

Cloned and setup per instructions. First run produced the error below:

Error [TypeError]: AWS[serviceName] is not a constructor at /home/kali/cloudsploit/collectors/aws/collector.js:139:119 at /home/kali/cloudsploit/node_modules/async/dist/async.js:3113:16 at replenish (/home/kali/cloudsploit/node_modules/async/dist/async.js:1014:17) at /home/kali/cloudsploit/node_modules/async/dist/async.js:1019:9 at Object.eachLimit$1 (/home/kali/cloudsploit/node_modules/async/dist/async.js:3199:24) at /home/kali/cloudsploit/collectors/aws/collector.js:109:23 at replenish (/home/kali/cloudsploit/node_modules/async/dist/async.js:1014:17) at /home/kali/cloudsploit/node_modules/async/dist/async.js:1019:9 at Object.eachOfLimit (/home/kali/cloudsploit/node_modules/async/dist/async.js:1044:24) at /home/kali/cloudsploit/collectors/aws/collector.js:88:19 { code: 'TypeError', time: 2024-09-04T21:18:03.251Z }

Node.js v18.20.1

ismaelalfarojr avatar Sep 04 '24 21:09 ismaelalfarojr

I debugged this error and found the codestar plugins to be causing it. I removed those two tests and then this error wasn`t thrown anymore. Nevertheless, the error in this thread started to be thrown: https://github.com/aquasecurity/cloudsploit/issues/2059.

I hope it helps! Thanks for jumping into these errors!

fmmorais avatar Sep 05 '24 19:09 fmmorais

Version 3.4.0 runs perfectly if Codestar plugins are removed. As version 3.5.0 included a new plugin for Codestar (CodeStarHasTags) would that one be a candidate for the root cause of this error?

fmmorais avatar Sep 05 '24 19:09 fmmorais

This crash can be resolved by downgrading aws-sdk to version 2.1680.0 or lower. Version 2.1681.0 of the SDK deprecated CodeStar: https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md#216810

DanielIntruder avatar Sep 10 '24 10:09 DanielIntruder

This crash can be resolved by downgrading aws-sdk to version 2.1680.0 or lower. Version 2.1681.0 of the SDK deprecated CodeStar: https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md#216810

How do you do that, can you give steps to do it?

morpheuslord avatar Oct 17 '24 08:10 morpheuslord

This crash can be resolved by downgrading aws-sdk to version 2.1680.0 or lower. Version 2.1681.0 of the SDK deprecated CodeStar: https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md#216810

How do you do that, can you give steps to do it?

I edited the package.json file to replace the aws-sdk dependency line with "aws-sdk": "2.1680.0",. I believe npm i [email protected] should also work.

DanielIntruder avatar Oct 17 '24 10:10 DanielIntruder

This crash can be resolved by downgrading aws-sdk to version 2.1680.0 or lower. Version 2.1681.0 of the SDK deprecated CodeStar: https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md#216810

How do you do that, can you give steps to do it?

I edited the package.json file to replace the aws-sdk dependency line with "aws-sdk": "2.1680.0",. I believe npm i [email protected] should also work.

This worked but now another issue started

[INFO][REGIONS] Could not load all regions from EC2: {"message":"Missing region in config","code":"ConfigError","time":"2024-10-17T13:10:58.627Z"}

morpheuslord avatar Oct 17 '24 13:10 morpheuslord

This crash can be resolved by downgrading aws-sdk to version 2.1680.0 or lower. Version 2.1681.0 of the SDK deprecated CodeStar: https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md#216810

How do you do that, can you give steps to do it?

I edited the package.json file to replace the aws-sdk dependency line with "aws-sdk": "2.1680.0",. I believe npm i [email protected] should also work.

This worked but now another issue started

[INFO][REGIONS] Could not load all regions from EC2: {"message":"Missing region in config","code":"ConfigError","time":"2024-10-17T13:10:58.627Z"}

How to fix it? [INFO][REGIONS] Could not load all regions from EC2: {"message":"Missing region in config","code":"ConfigError","time":"2024-10-31T09:05:22.269Z"}

tuandat1303 avatar Oct 31 '24 09:10 tuandat1303

This crash can be resolved by downgrading aws-sdk to version 2.1680.0 or lower. Version 2.1681.0 of the SDK deprecated CodeStar: https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md#216810

How do you do that, can you give steps to do it?

I edited the package.json file to replace the aws-sdk dependency line with "aws-sdk": "2.1680.0",. I believe npm i [email protected] should also work.

This worked but now another issue started

[INFO][REGIONS] Could not load all regions from EC2: {"message":"Missing region in config","code":"ConfigError","time":"2024-10-17T13:10:58.627Z"}

How to fix it? [INFO][REGIONS] Could not load all regions from EC2: {"message":"Missing region in config","code":"ConfigError","time":"2024-10-31T09:05:22.269Z"}

I used the docker image instead of running this locally 👍 .

morpheuslord avatar Nov 02 '24 08:11 morpheuslord

Thank you @DanielIntruder . Its working after I updated the package.

ajutamangdev avatar Nov 07 '24 01:11 ajutamangdev

Removed codestar plugins from running, https://github.com/aquasecurity/cloudsploit/pull/2130. Thanks

tzurielweisberg avatar Mar 03 '25 08:03 tzurielweisberg