akamai / NetStorageKit-PHP

Akamai NetStorage for PHP
http://developer.akamai.com
Apache License 2.0
18 stars 19 forks source link

HTTP API returns 400 - Bad Request error deleting a file with ObjectStoreAdapter #14

Closed Nikschavan closed 4 years ago

Nikschavan commented 4 years ago

This is the error returned from the API when trying to delete a file -

Client error: `GET https://example.com/file.png` resulted in a `400 Bad Request` response:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Req (truncated...)

Here is the backtrace where the API fails with this error -

League\Flysystem\Filesystem->delete, League\Flysystem\Filesystem->assertPresent, League\Flysystem\Filesystem->has, Akamai\NetStorage\AbstractAdapter->has, Akamai\NetStorage\ObjectStoreAdapter->getMetadata

After some debugging, I noticed the files are deleted successfully if encoding parameter from the Akamai\NetStorage\ObjectStoreAdapter->getMetadata is removed.

Any ideas what must be missing in this case?

Nikschavan commented 4 years ago

Hey @dshafik just checking if you have any idea on this?

dshafik commented 4 years ago

@Nikschavan I'm no longer with Akamai, and therefore no longer the maintainer of this package. Maybe @javiergarza can point you in the right direction?

javiergarza commented 4 years ago

@Nikschavan I have passed the feedback to the new owner of this repo. Waiting for him to decide how to proceed...

Nikschavan commented 4 years ago

Hi, Thank you. Actually I did find out what the problem was in my case.

The Netstorage account that I was using was not updated yet to ObjectStore since we are still under this migration process. When I use a test account with NS4 active I don't see this error.

So I have switched to using FileStoreAdapter This seems to be able to write/delete files from Netstorage v3 as well as v4 in our testing. My assumption before was these two adapters are for NS3 and NS4 separately and would not work interchangeably, but luckily that does not seem to be the case.

So our plan is to keep using the FileStoreAdapter adapter now and also after the accounts get updated to NS4.