community.digitalocean icon indicating copy to clipboard operation
community.digitalocean copied to clipboard

Internal DO API failures lead to non-informative error messages

Open y8 opened this issue 3 years ago • 0 comments

SUMMARY

For last few days I was lucky to face failures in multiple components somewhere inside DO infra: API were throwing 500's here and there.

As a result, I've seen few places where errors are not handled well or information provided by error handler is not clear about what exactly happened.

STEPS TO REPRODUCE

At least following actions failed

- name: Create volume
  community.digitalocean.digital_ocean_block_storage:
    state: present
    command: create
    volume_name: "test-name-vol"
    region: "fra1"
    block_size: "10"
- name: Create firewall rule
  community.digitalocean.digital_ocean_firewall:
    name: fw-test-rule
    state: present
    outbound_rules: []
    inbound_rules:
      - protocol: "tcp"
        ports: "20000-20100"
        sources:
          tags: ["group-foobar"]
    tags: ["fw-rules"]

As a result only "Internal Server Error" were printed, giving no details what exactly happened and at which stage.

Seems like send method is a good place to handle failures and rate-limit related errors, to ensure consistent error handling:

https://github.com/ansible-collections/community.digitalocean/blob/3e81f0c9ac16cd34aff609577b359deb0028e7a3/plugins/module_utils/digital_ocean.py#L67-L84

Most likely, DO support will be involved and they would ask to provide following information:

  1. Request URI, params and body
  2. Response code, headers and body

So it would be great to have this info in error message, along with link to DO status page and support center.

Thanks!

y8 avatar Nov 19 '21 17:11 y8