Skip to content

Request to delete PFFile from Parse Server using REST DELETE with master key returns 404 #4879

Closed
@johndoehelloworld

Description

@johndoehelloworld

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions