setup-localstack icon indicating copy to clipboard operation
setup-localstack copied to clipboard

Error parsing list of instance when empty response

Open chrisdemers opened this issue 7 months ago • 0 comments

I have the error 'jq: error (at :1): Cannot index boolean with string "instance_name"' when get instances request returns empty list

list_response=$(curl -X GET \ -H "ls-api-key: ${LOCALSTACK_AUTH_TOKEN:-${LOCALSTACK_API_KEY:-${{ inputs.localstack-api-key }}}}" \ -H "content-type: application/json" \ https://api.localstack.cloud/v1/compute/instances)

instance_exists=$(echo "$list_response" | jq --arg NAME "$previewName" '.[] | select(.instance_name == $NAME)')

Action call:

- name: Start LocalStack uses: LocalStack/[email protected] with: github-token: ${{ secrets.GITHUB_TOKEN }} use-pro: true install-awslocal: true include-preview: false skip-ephemeral-stop: true state-backend: ephemeral state-action: start preview-cmd: awslocal s3api create-bucket --bucket test-devops-local env: LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}

It works when I manually create an ephemeral instance manually before triggering my workflow

chrisdemers avatar Jul 07 '25 19:07 chrisdemers