Skip to content

Unable to delete a file stored in Google Cloud Storage using Parse.Cloud.httpRequest #3837

Closed

Description

@wookiem

Issue Description

Unable to delete a file stored in Google Cloud Storage using Parse.Cloud.httpRequest.

Steps to reproduce

Parse.Cloud.httpRequest({
	method: 'DELETE',
	url: photoUrl,
	headers: {
		"X-Parse-Application-Id": process.env.APP_ID,
		"X-Parse-Master-Key" : process.env.MASTER_KEY,
		"X-Parse-Session-Token": requester.getSessionToken(),
	}
})
.then((httpResponse) => {
	console.log(httpResponse.text);
})
.catch((error) => {
	console.error('Request failed with error:' + error.text);
})

Expected Results

File is deleted

Actual Outcome

Google Cloud Storage returns Access denied error.

Environment Setup

  • Server

    • parse-server version : 2.3.8
    • parse-server-gcs-adapter version : 1.1.2
    • Operating System: MacOS Sierra 10.12.4
    • Hardware: Apple iMac
    • Localhost or remote server? Localhost
  • Google Cloud Platform

    • Service account permissions set to ["Editor", "Storage Admin", "Storage Object Admin"]

Logs/Trace

Parse-server console output:

verbose: REQUEST for [DELETE] /parse/classes/Photo/HDLbppIQpB: {} method=DELETE, url=/parse/classes/Photo/HDLbppIQpB, host=192.168.0.190:1337, connection=keep-alive, content-length=195, origin=http://localhost:3003, user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36, content-type=text/plain, accept=*/*, referer=http://localhost:3003/, accept-encoding=gzip, deflate, accept-language=en-US,en;q=0.8, 
Request failed with error:<?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message><Details>Anonymous users does not have storage.objects.delete access to bucket <my bucket>.</Details></Error>

Google Cloud Storage log:
cs_method: DELETE
cs_uri: //76cf0e7588857ca92cdcc1bfb8540c6b_Room.jpg
sc_status: 403
cs_bytes: 0
sc_bytes: 208
cs_host: storage.googleapis.com
cs_user_agent: gzip(gfe)

Activity

  1. wookiem commented on May 20, 2017

    @wookiem
    Author

    I've also successfully tested DELETE using Google OAuth 2.0 Playground using my personal gmail account set with same permissions as the service account used by Parse Server. So, I'm reasonably confident that my permissions are set correctly.

  2. flovilmart commented on May 20, 2017

    @flovilmart
    Contributor
  3. wookiem commented on May 20, 2017

    @wookiem
    Author

    @flovilmart Ah, sorry about that. I moved it over.

  4. flovilmart commented on May 20, 2017

    @flovilmart
    Contributor

    No problem! We should probably have somethjng in the issue template to indicate it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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