testflows / TestFlows-GitHub-Hetzner-Runners

Autoscaling Self-Hosted GitHub Actions Runners on Hetzner Cloud.
https://testflows.com
Other
34 stars 3 forks source link

TypeError: cannot unpack non-iterable NoneType object #19

Closed guidoiaquinti closed 5 months ago

guidoiaquinti commented 5 months ago

šŸ‘‹ Hi! First of all, nice project! I've tried to deploy the service using your documentation. I can see the VM provisioned correctly but it's failing to register as GitHub self-hosted runner. Here's the log from github-hetzner-runners cloud status:

14:39:19    > May 24 12:37:53 github-hetzner-runners github-hetzner-runners[3647]: 12:37:53 šŸ€ Found new potential zombie server github-hetzner-runner-9224036990-25378510349
14:39:19    > May 24 12:38:00 github-hetzner-runners github-hetzner-runners[3647]: 12:38:00 šŸ€ Trying to connect to github-hetzner-runner-9224036990-25378510349@XXXXX...1
14:39:19    > May 24 12:38:08 github-hetzner-runners github-hetzner-runners[3647]: 12:38:08 šŸ€ Trying to connect to github-hetzner-runner-9224036990-25378510349@XXXXX...2
14:39:19    > May 24 12:38:13 github-hetzner-runners github-hetzner-runners[3647]: 12:38:13 šŸ€ Trying to connect to github-hetzner-runner-9224036990-25378510349@XXXXX...3
14:39:19    > May 24 12:38:15 github-hetzner-runners github-hetzner-runners[3647]: 12:38:15    > github-hetzner-runner-9224036990-25378510349
14:39:19    > May 24 12:38:15 github-hetzner-runners github-hetzner-runners[3647]: 12:38:15 šŸ€ Getting registration token for the runner
14:39:19    > May 24 12:38:15 github-hetzner-runners github-hetzner-runners[3647]: 12:38:15 āŒ TypeError: cannot unpack non-iterable NoneType object
14:39:19    > May 24 12:38:35 github-hetzner-runners github-hetzner-runners[3647]: 12:38:35 šŸ€ Logging in to GitHub
14:39:19    > May 24 12:38:35 github-hetzner-runners github-hetzner-runners[3647]: 12:38:35 šŸ€ Checking current API calls consumption rate
14:39:19    > May 24 12:38:36 github-hetzner-runners github-hetzner-runners[3647]: 12:38:36 šŸ€ Consumed 4 calls in 60 sec, 4965 calls left, reset in 3317 sec

Version

(infrastructure) āžœ  infrastructure git:(main) āœ— github-hetzner-runners -v
1.7.240516.1143322
vzakaznikov commented 5 months ago

Hi @guidoiaquinti, could you double check the permissions of your GitHub token and repository URL? Here is the code where it is failing for you https://github.com/testflows/TestFlows-GitHub-Hetzner-Runners/blob/main/testflows/github/hetzner/runners/scale_up.py#L118.

vzakaznikov commented 5 months ago

Please make sure you set all three environment variables to the values that correspond to your project. Specifically, the GITHUB_REPOSITORY should specify your project's repository for which you have created a GITHUB_TOKEN that has the correct permissions. See https://github.com/testflows/TestFlows-GitHub-Hetzner-Runners?tab=readme-ov-file#getting-started-tutorial for more details.

For example,

export GITHUB_TOKEN=ghp_...
export GITHUB_REPOSITORY=...
export HETZNER_TOKEN=GJzdc...

github-hetzner-runners cloud deploy
vzakaznikov commented 5 months ago

I've doubled checked against my https://github.com/vzakaznikov/demo-testflows-github-hetzner-runners/ repository by deploying new cloud service and everything works as expected.

Please let me know if you still can't get it to work. You could dump full logs by running github-hetzner-runners cloud log command. Also, don't forget to delete any servers after any trial runs using github-hetzner-runners delete and github-hetzner-runners cloud delete commands.

guidoiaquinti commented 5 months ago

šŸ‘‹ Hi everyone! Thank you for your help. I discovered that the issue was indeed related to the type of token used: I initially created a "Fine-grained token" instead of a "Token (classic)," which caused the problem.

vzakaznikov commented 5 months ago

The fine-grained tokens could work, but I haven't tried using them yet to see what specific permissions they need.

vzakaznikov commented 5 months ago

I've tried different combinations of permissions for the fine-grained tokens but none work. So yes, fine-graned tokens can't be used.

guidoiaquinti commented 5 months ago

I've tried different combinations of permissions for the fine-grained tokens but none work. So yes, fine-graned tokens can't be used.

Thank you for double checking! šŸ™