Search code examples
azuresdkazure-data-lakeazure-data-lake-gen2

Azure ADLSGEN2 - API Error 400 - DatalakeStorageException The request URI is invalid


I'm using Azure SDK (Java) to create directory, upload files, move files in ADLSGEN2.

My input are very simple, it look like:

path : /path/to/fileOrFolder

But I got following Error:

com.azure.storage.file.datalake.models.DatalakeStorageException: Status Error code 400: The request URI is invalid ...

Solution

  • I share the solution here, as it cost me several hours to 1 day of debugging ... for just this:

    The problem was that I had a leading Slash in front of the path.

    Solution: Remove the first slash at the beginning of the path:

    Replace

    /path/to/fileOrFolder

    by

    path/to/fileOrFolder

    It's the same pattern for all action : upload, create directory, rename, delete, ...

    I think Azure SDK should do the normalization itself or have a more comprehensive error message ...