Repository navigation
Description
We use GitHub Issues for bugs.
If you have a non-bug question, ask on Stack Overflow or Server Fault:
If you have a vulnerability disclosure, please follow our policy available here https://github.com/parse-community/parse-server/blob/master/SECURITY.md
You may also search through existing issues before opening a new one: https://github.com/parse-community/parse-server/issues?utf8=%E2%9C%93&q=is%3Aissue
--- Please use this template. If you don't use this template, your issue may be closed without comment. ---
Issue Description
My request to delete PFFile from Parse Server using REST DELETE with master key returns 404. Code:
Parse.Cloud.httpRequest({
method: 'DELETE',
url: profilePhotoLargeSizedImageURL,
headers: {
'X-Parse-Application-Id': parseConfig.appId,
'X-Parse-Master-Key': parseConfig.masterKey
}
}).then(function (httpResponse) {
logger.log(groupLogger,destroyAvatarImagesFromGroup() | Successfully deleted file at ${profilePhotoLargeSizedImageURL})
}, function (httpResponse) {
logger.log(groupLogger,destroyAvatarImagesFromGroup() | Failed to delete file at ${profilePhotoLargeSizedImageURL} | HTTP Response Status: ${httpResponse.status})
})
I know that the URL is right since when I access it in browser, it returns the image.
I'm using Google Cloud Storage (parse-server-gcs-adapter).
Question: How do I delete files stored as PFFiles?
Related question: How do I overwrite PFFiles?
Note that I'm classifying this as a bug since calling delete on a PFFile is supposed to delete the file. I also asked this question on Stack Overflow, but no luck with help. I'm really hoping I get help here.
Steps to reproduce
Call delete on PFFile URL as so:
Parse.Cloud.httpRequest({
method: 'DELETE',
url: profilePhotoLargeSizedImageURL,
headers: {
'X-Parse-Application-Id': parseConfig.appId,
'X-Parse-Master-Key': parseConfig.masterKey
}
}).then(function (httpResponse) {
logger.log(groupLogger,destroyAvatarImagesFromGroup() | Successfully deleted file at ${profilePhotoLargeSizedImageURL})
}, function (httpResponse) {
logger.log(groupLogger,destroyAvatarImagesFromGroup() | Failed to delete file at ${profilePhotoLargeSizedImageURL} | HTTP Response Status: ${httpResponse.status})
})
Expected Results
Calling delete on PFFile from Parse Server using REST DELETE should delete the file in Google Cloud
Actual Outcome
Request returns 404
Environment Setup
-
Server
- parse-server version (Be specific! Don't say 'latest'.) : 2.7.2
- Operating System: Mac OS High Sierra 10.13.5 (17F77)
- Hardware: iMac
- Localhost or remote server? Local server, but using Google Cloud Storage adapter
-
Database
- MongoDB version: 3.6.3
- Storage engine: ?
- Hardware: iMac
- Localhost or remote server? Local server, but using Google Cloud Storage adapter
Logs/Trace
Include all relevant logs. You can turn on additional logging by configuring VERBOSE=1 in your environment.
Activity
dplewis commentedon Jul 10, 2018
I wouldn't recommend using Parse.Cloud.httpRequest. Instead use the request node package.
There exists a test for this
https://github.com/parse-community/parse-server/blob/master/spec/ParseFile.spec.js#L91
Can you try to create a failing test? Ensure your keys are correct.
johndoehelloworld commentedon Jul 12, 2018
I noticed in the test that it passes the rest api key. I included that in my headers, and it still returns 404. I tried it with google cloud storage adapter and also without any adapters simply stored in Mongo – no luck. Thoughts anyone?
dplewis commentedon Jul 17, 2018
Can you output your logs VERBOSE=1?
georgesjamous commentedon Jul 18, 2018
@johndoehelloworld
First make sure that "parseConfig.appId" is returning the correct info, not sure what "parseConfig" is.
Also, I don't know if this could cause problems but if you are using a file key try to included also.
Since the test is passing, seems like its problem from your end.
Also, are you able to access the file from Parse ? and/or delete it from other SDKs ?
stale commentedon Sep 18, 2018
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.