Skip to content

Commit ac9d7b0

Browse files
authored
Fix DigitalOcean API error handling and improve debugging (fixes #14829) (#14830)
* Fix DigitalOcean API error handling and debugging (fixes #14829) - Replace hardcoded no_log with configurable algo_no_log variable - Add comprehensive error checking with specific guidance for each HTTP status code - Provide actionable troubleshooting steps without exposing sensitive data - Add troubleshooting section to config.cfg for better discoverability - Enable debugging by setting algo_no_log: false when needed This fix addresses issue #14829 where users couldn't debug DigitalOcean API failures due to hidden error messages from no_log: true directive. * Clean up config.cfg - consolidate algo_no_log setting - Move algo_no_log setting to top troubleshooting section - Remove duplicate setting from line 117 - Keep the prominent warning about debugging at the top where users will see it - Cleaner, single source of truth for the setting
1 parent cddb5df commit ac9d7b0

File tree

2 files changed

+64
-4
lines changed

2 files changed

+64
-4
lines changed

config.cfg

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
---
22

3+
# ============================================
4+
# TROUBLESHOOTING DEPLOYMENT ISSUES
5+
# ============================================
6+
# If your deployment fails with hidden/censored output, temporarily set
7+
# algo_no_log to 'false' below. This will show detailed error messages
8+
# including API responses.
9+
# IMPORTANT: Set back to 'true' before sharing logs or screenshots!
10+
# ============================================
11+
algo_no_log: true # Set to 'false' for debugging (shows sensitive data in output)
12+
313
# This is the list of users to generate.
414
# Every device must have a unique user.
515
# You can add up to 65,534 new users over the lifetime of an AlgoVPN.
@@ -103,9 +113,6 @@ wireguard_PersistentKeepalive: 0
103113
local_service_ip: "{{ '172.16.0.1' | ansible.utils.ipmath(1048573 | random(seed=algo_server_name + ansible_fqdn)) }}"
104114
local_service_ipv6: "{{ 'fd00::1' | ansible.utils.ipmath(1048573 | random(seed=algo_server_name + ansible_fqdn)) }}"
105115

106-
# Hide sensitive data in Ansible output during deployment (passwords, keys, etc.)
107-
# This is NOT related to privacy/logging on the VPN server itself
108-
algo_no_log: true
109116

110117
congrats:
111118
common: |

roles/cloud-digitalocean/tasks/prompts.yml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,60 @@
2323
Content-Type: application/json
2424
Authorization: Bearer {{ algo_do_token }}
2525
register: _do_regions
26-
no_log: true
26+
no_log: "{{ algo_no_log | default(true) }}"
27+
failed_when: false
28+
29+
- name: Check DigitalOcean API response
30+
fail:
31+
msg: |
32+
{% if _do_regions.status == 401 %}
33+
DigitalOcean API authentication failed (401 Unauthorized)
34+
35+
Your API token is invalid or expired. Please:
36+
1. Go to https://cloud.digitalocean.com/settings/api/tokens
37+
2. Create a new token with 'Read' and 'Write' scopes
38+
3. Run the deployment again with the new token
39+
40+
{% elif _do_regions.status == 403 %}
41+
DigitalOcean API access denied (403 Forbidden)
42+
43+
Your API token lacks required permissions. Please:
44+
1. Go to https://cloud.digitalocean.com/settings/api/tokens
45+
2. Ensure your token has both 'Read' and 'Write' scopes
46+
3. Consider creating a new token with full access
47+
48+
{% elif _do_regions.status == 429 %}
49+
DigitalOcean API rate limit exceeded (429 Too Many Requests)
50+
51+
You've hit the API rate limit. Please:
52+
1. Wait 5-10 minutes before retrying
53+
2. Check if other applications are using your token
54+
55+
{% elif _do_regions.status == 500 or _do_regions.status == 502 or _do_regions.status == 503 %}
56+
DigitalOcean API server error ({{ _do_regions.status }})
57+
58+
DigitalOcean is experiencing issues. Please:
59+
1. Check https://status.digitalocean.com for outages
60+
2. Wait a few minutes and try again
61+
62+
{% elif _do_regions.status is undefined %}
63+
Failed to connect to DigitalOcean API
64+
65+
Could not reach api.digitalocean.com. Please check:
66+
1. Your internet connection
67+
2. Firewall rules (port 443 must be open)
68+
3. DNS resolution for api.digitalocean.com
69+
70+
{% else %}
71+
DigitalOcean API error (HTTP {{ _do_regions.status }})
72+
73+
An unexpected error occurred. Please:
74+
1. Verify your API token at https://cloud.digitalocean.com/settings/api/tokens
75+
2. Check https://status.digitalocean.com for service issues
76+
{% endif %}
77+
78+
For detailed error messages: Set 'algo_no_log: false' in config.cfg and run again
79+
when: _do_regions.status != 200
2780

2881
- name: Set facts about the regions
2982
set_fact:

0 commit comments

Comments
 (0)