aws-ssm-send-command icon indicating copy to clipboard operation
aws-ssm-send-command copied to clipboard

Issue with AWS SSM Send-Command

Open Sergushka opened this issue 4 years ago • 12 comments

Hi, thanks for an awesome action

I've set this role AmazonSSMFullAccess to my user and my instance also has this role.

I've added all vulnerable infrormation to secrets. When running the job I get this error I've tried single instance and both multiple instances but no effect

instance-ids: | {{ secrets.INSTANCE_ID }} {{ secrets.INSTANCE_ID }} instance-ids: {{ secrets.INSTANCE_ID }}

InvalidParameterType: Expected params.InstanceIds to be an Array
    at ParamValidator.fail (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:50:37)
    at ParamValidator.validateType (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:232:10)
    at ParamValidator.validateList (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:99:14)
    at ParamValidator.validateMember (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:90:21)
    at ParamValidator.validateStructure (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:75:14)
##[error]InvalidParameterType: Expected params.InstanceIds to be an Array
    at ParamValidator.validateMember (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:88:21)
    at ParamValidator.validate (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:34:10)
    at Request.VALIDATE_PARAMETERS (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/event_listeners.js:132:42)
    at Request.callListeners (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at callNextListener (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/sequential_executor.js:96:12) {
  message: 'Expected params.InstanceIds to be an Array',
  code: 'InvalidParameterType',
  time: 2020-08-13T11:14:06.846Z
} InvalidParameterType: Expected params.InstanceIds to be an Array
    at ParamValidator.fail (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:50:37)
    at ParamValidator.validateType (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:232:10)
    at ParamValidator.validateList (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:99:14)
    at ParamValidator.validateMember (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:90:21)
    at ParamValidator.validateStructure (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:75:14)
    at ParamValidator.validateMember (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:88:21)
    at ParamValidator.validate (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/param_validator.js:34:10)
    at Request.VALIDATE_PARAMETERS (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/event_listeners.js:132:42)
    at Request.callListeners (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at callNextListener (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.2/node_modules/aws-sdk/lib/sequential_executor.js:96:12)```

Sergushka avatar Aug 13 '20 11:08 Sergushka

Thank you for your comment.

Actually 1.0.2 version has some issue because of aws-sdk package, but the issue has been released at 1.0.4 version. Please use the action, and I recommend to use single instance.

If you get same error again, let me know on this issue page.

peterkimzz avatar Aug 14 '20 02:08 peterkimzz

I've tried kind of the same action here https://github.com/marketplace/actions/aws-ssm-send-command-temp and it works fine with the same settings

Sergushka avatar Aug 14 '20 15:08 Sergushka

Buh

agatha7l avatar Sep 28 '20 20:09 agatha7l

@peterkimzz , I experienced this issue right now, I have IAM User with AmazonSSMFullAccess and I also attach AmazonSSMFullAccess roles to the instance but I got this error

/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/request.js:31
            throw err;
            ^

InvalidInstanceId: null
    at Request.extractError (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/protocol/json.js:52:27)
    at Request.callListeners (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/request.js:688:14)
    at Request.transition (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/request.js:690:12)
    at Request.callListeners (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/master/node_modules/aws-sdk/lib/sequential_executor.js:116:18)

Edit: sorry wrong mention

ghost avatar Nov 11 '20 08:11 ghost

Resolved 😓 , It turned out I'm using master branch 🙏

ghost avatar Nov 11 '20 08:11 ghost

Hi there, I also have issue with AWS SSM Send-Command. My github action is running correctly, but the status of the command keep of staying "Pending" forever, how can I fix it? this is my output: { Command: { CommandId: '5fab5b78-b7ac-492b-aeee-ff1ad62f0f9d', DocumentName: 'AWS-RunShellScript', DocumentVersion: '', Comment: 'Deploying staging branch', ExpiresAfter: 2020-11-22T15:39:16.677Z, Parameters: { commands: [Array], workingDirectory: [Array] }, InstanceIds: [ '***' ], Targets: [], RequestedDateTime: 2020-11-22T13:39:16.677Z, Status: 'Pending', StatusDetails: 'Pending', OutputS3BucketName: '', OutputS3KeyPrefix: '', MaxConcurrency: '50', MaxErrors: '0', TargetCount: 1, CompletedCount: 0, ErrorCount: 0, DeliveryTimedOutCount: 0, ServiceRole: '', NotificationConfig: { NotificationArn: '', NotificationEvents: [], NotificationType: '' }, CloudWatchOutputConfig: { CloudWatchLogGroupName: '', CloudWatchOutputEnabled: false }, TimeoutSeconds: 3600 } }

RazRCL avatar Nov 22 '20 13:11 RazRCL

Hi, @RazRCL

Sometimes I got same issue like your case, but it resolved when I rebooted or recreated an instance. I don't know why the task is pending.

I guess it's not the error of Github action, might be aws-sdk.

Please try it and let me know.

peterkimzz avatar Nov 23 '20 04:11 peterkimzz

/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/request.js:31
            throw err;
            ^

InvalidInstanceId: null
    at Request.extractError (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/protocol/json.js:51:27)
    at Request.callListeners (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/request.js:688:14)
    at Request.transition (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/request.js:690:12)
    at Request.callListeners (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.4/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
  message: null,
  code: 'InvalidInstanceId',
  time: 2021-09-17T15:45:59.669Z,
  requestId: '4e396d23-3cf2-40d8-8d3c-412eaa7774eb',
  statusCode: 400,
  retryable: false,
  retryDelay: 43.30718366886279
}

I am getting this error. I have tried with v1.0.1, v1.0.4 and master. Same issue persists. @peterkimzz please help

Editing: This is fixed by setting security group to default. I was blocking the SSM via security group.

souravpurkait360 avatar Sep 17 '21 15:09 souravpurkait360

Hi, @RazRCL

Sometimes I got same issue like your case, but it resolved when I rebooted or recreated an instance. I don't know why the task is pending.

I guess it's not the error of Github action, might be aws-sdk.

Please try it and let me know.

@peterkimzz Is this still an issue in 2021? I tried to use the script and the status is still pending.

vinodMS avatar Dec 30 '21 15:12 vinodMS

Hi @peterkimzz everything seems to be fine on github actions but status is always pending and i have rebooted my instance as you suggested. what can i do to make it work?

KimBitrus26 avatar Feb 16 '22 09:02 KimBitrus26

I made a slight amendment in the code due to an error following the build command, but when I try and pull the code to the EC2 I get this error:

Run peterkimzz/[email protected] with: aws-region: ca-central-1 comment: Deploy the main branch working-directory: /home/ec2-user/mocksocialmediawebsite command: /bin/sh /home/ec2-user/deploy.sh Error: Input required and not supplied: aws-access-key-id Error: Error: Input required and not supplied: aws-access-key-id at Object.getInput (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.1/node_modules/@actions/core/lib/core.js:78:15) at SanitizeInputs (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.1/index.js:42:29) at Object. (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.1/index.js:6:18) at Module._compile (internal/modules/cjs/loader.js:959:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) at Module.load (internal/modules/cjs/loader.js:815:32) at Function.Module._load (internal/modules/cjs/loader.js:727:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) at internal/main/run_main_module.js:17:11 Error: Input required and not supplied: aws-access-key-id at Object.getInput (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.1/node_modules/@actions/core/lib/core.js:78:15) at SanitizeInputs (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.1/index.js:42:29) at Object. (/home/runner/work/_actions/peterkimzz/aws-ssm-send-command/1.0.1/index.js:6:18) at Module._compile (internal/modules/cjs/loader.js:959:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) at Module.load (internal/modules/cjs/loader.js:815:32) at Function.Module._load (internal/modules/cjs/loader.js:727:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) at internal/main/run_main_module.js:17:11

I have the .pem file, but I am not sure where or how to add this

Any advice greatly appreciated

mcneilla avatar Feb 17 '22 16:02 mcneilla

is not .pem just learn bout github secrets

iamunadike avatar Jun 04 '22 17:06 iamunadike