Search code examples
azure-storageazure-data-lake-gen2

ADLS Gen 2 Storage API - Refusing Http Verbs


I'm having a problem with some endpoints within the ADLS Gen 2 API Path operations.

I can create, list, get properties of, and delete file systems just fine.

However, after adding a directory to a file system, certain verbs are failing - HEAD, GET, and DELETE.

For example, I have created a filesystem named c79b0781, with a directory path of abc/def

Call failed with status code 400 (The HTTP verb specified is invalid - it is not recognized by the server.): DELETE https://myadls.dfs.core.windows.net/c79b0781/abc?recursive=true&timeout=30

For headers, I have:

x-ms-version: 2018-11-09

I can delete the filesystem from the Azure Storage Explorer, but the API is refusing my query.

The List action is also failing with a similar error

Call failed with status code 400 (The HTTP verb specified is invalid - it is not recognized by the server.): GET https://myadls.dfs.core.windows.net/c79b0781?resource=filesystem&recursive=false&timeout=30

With headers:

x-ms-version: 2018-11-09

And finally, my Get Properties is also failing

Call failed with status code 400 (The HTTP verb specified is invalid - it is not recognized by the server.): HEAD https://myadls.dfs.core.windows.net/c79b0781?resource=filesystem&timeout=30

It seems to only happen when I add directories to the file system.

A bit more in depth:

This Test works

PUT https://myadls.dfs.core.windows.net/c79b0781?resource=filesystem
GET https://myadls.dfs.core.windows.net/c79b0781?recursive=false&resource=filesystem
DELETE https://myadls.dfs.core.windows.net/c79b0781?resource=filesystem

My second Test with directory creation

PUT https://myadls.dfs.core.windows.net/c79b0781?resource=filesystem
PUT https://myadls.dfs.core.windows.net/c79b0781/abc/123?resource=directory

After this point, the calls begin rejecting HTTP verbs

GET https://myadls.dfs.core.windows.net/c79b0781?recursive=false&resource=filesystem

Examining my directory create request closer, it looks like this:

PUT https://myadls.dfs.core.windows.net/c79b0781/abc/123?resource=directory

With Headers:

Authorization: [omitted]
Content-Length: 0

And I can see the folders in Storage explorer, I just cannot act on them after this point.

Test Case 2

I have started down a path wondering if it is permissions. So, I created a new File System through the Azure Storage Explorer with abc/def folder structure within.

Test 1 (passing)

Get List for directory "abc"
Get List for directory "abc/def"

Test 2 (failing)

Create Directory "uvw/xyz"
Get List for directory "abc" Fails here
Get List for directory "abc/def"
Get List for directory "uvw/xyz"

Once I create a directory through the api, it is as if the entire filesystem begins rejecting all HTTP requests.


Solution

  • This bug ended up leading me down a rabbit hole into my Flurl implementation that I am using for performing rest requests.

    The Put method had no body and was calling PutJsonAsync where according to the spec, it expects the content type to be application/octet-stream with content length 0.

    I replaced the call to PutJsonAsync to PutAsync and everything magically started working.

    So, there seems to be some bug within Flurl itself that caused this issue, due to my misuse in my wrapper code.