fastly
fastly copied to clipboard
PURGE is broken in 2.2.0
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.
@markdorison any thoughts on this?
🤔
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.
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 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?
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.
Any news on this? I have to use another lib to do the purging because of this bug.