Question

Seeing server errors when using the API

Posted December 30, 2020 395 views
APICDN

I am trying to clear a CDN cache via the API following this documentation (https://developers.digitalocean.com/documentation/v2/#purge-the-cache-for-an-existing-cdn-endpoint) and this code:

DELETE https://api.digitalocean.com/v2/cdn/endpoints/{{ endpoint }}/cache HTTP/1.1
Authorization: Bearer {{auth_token}}
Content-Type: application/json
Accept: application/json

{
    "files": [
        "uploads/staging/youth/en-gb/3_YOUTH_en-GB.mp3"
    ]
}

What I am seeing is that the request returns the expected 204 status and the cache is cleared when the cache is set, but when the cache is clear already (or at some other random times that I haven’t figured out yet) the request returns a 500 server error. From my testing, it looks like when this happens, the cache was not cleared.

Has anyone experienced this and / or can give some advice?

Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

I’ve just noticed this as well, but I’m not sure if it’s always done that or not. It would be nice for it to return 204 regardless if the file exists or not.

  • Actually after doing some more testing, I am getting a 500 error almost every time. My test procedure is to upload a different image with the same filename, then run the cache clear API.

    Here is what is in the Java error response for response code 500:
    {“id”: “Internal Server Error”, “message”: “Server Error” }

    I know my API request format is correct since I’ve been using it a long time and since it is working intermittently.

    • Well after even more testing, I’ve realized it’s completely just an intermittent failure on DO’s end.

      I can run the same clear CDN request over and over and it will fail around 90% of the time.

      I’m going to submit a ticket.