Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Failed to parse the task definition file: invalid JSON provided. Fix?


I can't seem to make the ECS deploy image run properly. Even when using you example code.

Here's the last few lines of the pipeline output. I had DEBUG turned on:

5b3de3e43369: Pull complete6fa0d3662c46: Pull completeDigest: sha256:1aa9f89c0c38960914214a2b71cdd11ebb7d39c0dde4d8f934541453ff1e1555Status: Downloaded newer image for bitbucketpipelines/aws-ecs-deploy:1.0.0INFO: Updating the task definition...DEBUG: Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-planeDEBUG: Changing event name from before-call.apigateway to before-call.api-gatewayDEBUG: Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.PredictDEBUG: Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to Changing event name from before-parameter-build.route53 to before-parameter-build.route-53DEBUG: Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.SearchDEBUG: Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-sectionDEBUG: Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTaskDEBUG: Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-sectionDEBUG: Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.SearchDEBUG: Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-sectionDEBUG: Looking for credentials via: envINFO: Found credentials in environment variables.DEBUG: Loading JSON file: /usr/local/lib/python3.7/site-packages/botocore/data/endpoints.jsonDEBUG: Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f759adc44d0>DEBUG: Loading JSON file: /usr/local/lib/python3.7/site-packages/botocore/data/ecs/2014-11-13/service-2.jsonDEBUG: Event creating-client-class.ecs: calling handler <function add_generate_presigned_url at 0x7f759adfd290>DEBUG: The s3 config key is not a dictionary type, ignoring its value of: NoneDEBUG: Setting ecs timeout as (60, 60)DEBUG: Loading JSON file: /usr/local/lib/python3.7/site-packages/botocore/data/_retry.jsonDEBUG: Registering retry handlers for service: ecs✖ Failed to parse the task definition file: invalid JSON provided.
Here is my task-definition-template.json file:
"family": "",
"executionRoleArn": "arn:aws:iam::#########:role/ecsTaskExecutionRole",
"containerDefinitions": [
"name": "aft-cms-api",
"image": "${IMAGE_NAME}",
"portMappings": [
"hostPort": 80,
"protocol": "tcp",
"containerPort": 80
"secrets": [
"valueFrom": "arn:aws:ssm:us-east-1:#########:parameter/CMS-APP-SECRET-DEV",
"name": "AppSettings__Secret"
"valueFrom": "arn:aws:ssm:us-east-1:###########:parameter/CMS-DB-CONN-INFO-DEV",
"name": "ConnectionStrings__AFTDataContext"
"memory": "512",
"taskRoleArn": "arn:aws:iam::###########:role/ecsTaskExecutionRole",
"compatibilities": [
"requiresCompatibilities": [
"networkMode": "awsvpc",
"cpu": "256"

1 answer

How are you running envsubst? I was noticed that when I tried to use the docker command for it (which I might have been using incorrectly), it would spit out an empty JSON file. So now I'm using this.

- apk add gettext
- export IMAGE_NAME="asdf"
- envsubst < task-definition-template.json > task-definition.json


The first line of my bitbucket-pipelines.yml file is:

image: python:3.7.4-alpine3.10


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

95 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you