fastly icon indicating copy to clipboard operation
fastly copied to clipboard

PURGE is broken in 2.2.0

Open poscar opened this issue 7 years ago • 6 comments

Looks like this change broke purging.

From the documentation:

The main entry point https://api.fastly.com/ for the API is not needed for an individual URL Instant Purge.

Also, looks like we shouldn't specify a body on the PURGE request, which we seem to be doing here: https://github.com/thisandagain/fastly/blob/develop/lib/index.js#L62-L65

These other docs indicate that for requests with API keys to work, it should be a POST request.

Our team reverted to 2.0.1 in order to get PURGE working again.

poscar avatar Jun 15 '17 18:06 poscar

@markdorison any thoughts on this?

thisandagain avatar Jun 15 '17 19:06 thisandagain

🤔

These other docs indicate that for requests with API keys to work, it should be a POST request.

@poscar Are you referring to the warning at the bottom of the page related to non-HTTPS sites? That's the only mention I see about the request being a POST.

In contrast, this is the API doc I was working off for purge and soft purge which specifies a PURGE request type.

I am trying to reconcile the two documents in my head but I am unclear as to what we might be doing wrong when reviewing the API documentation. I am not able to reproduce an error but I am sure our test cases are different.

markdorison avatar Jun 15 '17 19:06 markdorison

Thanks for the quick reply!

@markdorison The code here sends a PURGE request to url: 'https://api.fastly.com' + url, which is not what's specified in the documentation example curl -X PURGE http://www.example.com/image.jpg.

poscar avatar Jun 16 '17 16:06 poscar

@poscar Got it. Currently there is just that one function that handles all requests. One alternative would be to have to have a different path for this type of request. Maybe a different function? Or a conditional within that function?

@thisandagain what do you think?

markdorison avatar Jun 19 '17 17:06 markdorison

we're running into this problem too; purging from the Fastly console works like a charm, but the purge command via the authenticated client seems to do nothing.

bcoe avatar Jul 06 '17 19:07 bcoe

Any news on this? I have to use another lib to do the purging because of this bug.

hankmander avatar Oct 23 '17 14:10 hankmander