I am trying to run an aws cli command in Github actions to get messages from a queue. I need to use the output from the queue in another job. According to aws cli document for queues aws_receive_message the format of the output is an object that returns a list of messages.
But i keep getting these errors from Github actions:
Error: Unable to process file command output successfully.`
Error: Invalid format "Messages": [
Here is a snippet of my code:
- name: Receive Message
id: receive_message
run: |
message=`aws sqs receive-message --queue-url https://sqs.us-east1.amazonaws.com/myqueue.fifo
--attribute-names All
--message-attribute-names All --max-number-of-messages 10 --output json`
echo result $message
echo "message=$message" >> $GITHUB_OUTPUT
- name: Print Message
id: print_message
run: echo "${{ fromJson(steps.receive_message.outputs.message) }}"
I am assuming it something to do with the list being returned in the output that is not json formatted, but I am not sure how to resolve this.
Is there a way to resolve this error?