Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy via Actions: Cannot read property 'name' of null #53

Closed
pvasilyev opened this issue Apr 12, 2020 · 9 comments · Fixed by #63
Closed

Unable to deploy via Actions: Cannot read property 'name' of null #53

pvasilyev opened this issue Apr 12, 2020 · 9 comments · Fixed by #63

Comments

@pvasilyev
Copy link

Trying to use this action in my personal project (private repo so far). YML file is as follows: https://gist.github.com/pvasilyev/ceaf81d6943464bf77ac2a6a0b7602ad

I've verified that my aws user has all permissions listed in the https://github.com/aws-actions/amazon-ecs-deploy-task-definition#permissions but still w/o luck.

Logs excerpt:

Run aws-actions/amazon-ecs-deploy-task-definition@v1
  with:
    task-definition: /home/runner/work/_temp/task-definition-3216nPr47VbD5lae.json
    service: tgbot-webhook-service
    cluster: tgbot-springboot-cluster
    wait-for-service-stability: true
  env:
    AWS_DEFAULT_REGION: us-east-1
    AWS_REGION: us-east-1
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
##[error]Cannot read property 'name' of null
@clareliguori
Copy link
Member

This is likely a failure to parse your task definition file, for example a missing required field. To confirm, you can turn on debug logs by setting the secret ACTIONS_STEP_DEBUG to true in your repo.

@clareliguori
Copy link
Member

Added troubleshooting directions in 7dc1449

@kaischwanke
Copy link

kaischwanke commented May 5, 2020

I have the same issue. Thanks for putting in the debug option @clareliguori ! But even though I can now see the task definition file being used, I still don't know what's wrong with it.
I'm aware the error is being thrown in the aws sdk, but can someone give any more clues on how analyse/validate what could be wrong with the file?

@clareliguori
Copy link
Member

This will give you the format:
aws ecs register-task-definition --generate-cli-skeleton

If you'd like to paste your generated task def here from the debug log (removing any sensitive info), I can take a look

@kaischwanke
Copy link

Hi @clareliguori , thanks so much for getting back to me. I was already using a file generate using the command you have suggested. I have uploaded it here: https://gist.github.com/kaischwanke/aef290d2e90c0ff071803e6631da40cd
Also, with ACTIONS_STEP_DEBUG=true I can see that the modified file in failing step (Deploy Amazon ECS task definition) looks a little different:
https://gist.github.com/kaischwanke/a59a3e35cdce46c96a8d6080a1e08091

@clareliguori
Copy link
Member

@kaischwanke I don't see where the two task defs you pasted are different, is the second one actually the same as the first?

Anyway, the generate command adds all the possible options and expects them all to be filled in or removed if you are not using them. For example, cpu and memory should be removed or set to non-zero values.

      "cpu": 0,
      "memory": 0,

It is easier to start from a task definition that is already registered, and store that in your repo:
aws ecs describe-task-definition --task-definition first-run-task-definition > ecs-task-definition.json

@kaischwanke
Copy link

Sorry @clareliguori , seems I did upload the same file twice. I have updated the second one now. That's the output I see in the GitHub action. The first one is the one I have in my repository.

@clareliguori
Copy link
Member

@kaischwanke I put up a fix for the 'null' error, but even when that is released, this is still not a valid task definition since it's expecting you to fill in more information or remove attributes you don't need. But, at least you'll get some better validation messages once the fix is released.

@mergify mergify bot closed this as completed in #63 May 7, 2020
@kaischwanke
Copy link

You're amazing, thanks @clareliguori !
I did get my service to work by using the existing task definition as you suggested:
aws ecs describe-task-definition --task-definition first-run-task-definition > ecs-task-definition.json
(I just had to unwrap the contents of the root key 'taskDefinition' from that JSON)
Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants