Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azurite alway return 400 when use sasUrl generate by Azurite #2391

Open
luyue14 opened this issue Apr 24, 2024 · 1 comment
Open

Azurite alway return 400 when use sasUrl generate by Azurite #2391

luyue14 opened this issue Apr 24, 2024 · 1 comment
Assignees
Labels
blob-storage featureparity Tracking issues for catching up feature parity

Comments

@luyue14
Copy link

luyue14 commented Apr 24, 2024

Which service(blob, file, queue, table) does this issue concern?

Blob and file

Which version of the Azurite was used?

3.29.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

npm

What's the Node.js version?

What problem was encountered?

Azurite alway return 400 bad request.
I use the Azure SDK(.net core: Azure.Storage.Files.DataLake SDK) call Azurite, if I use sasUrl which is generated by Storage the code works well, but if I use the sasUrl generate by Azurite, Azurite will return 400.

Steps to reproduce the issue?

  1. start Azurite azurite -L --skipApiVersionCheck --silent --location c:\azurite --debug c:\azurite\debug.log
  2. Generate sasUrl

DataLakeSasBuilder builder = new DataLakeSasBuilder();
builder.SetPermissions(DataLakeSasPermissions.All);
builder.ExpiresOn = DateTime.UtcNow.AddDays(1);
builder.Resource = "d";
builder.Protocol = SasProtocol.Https;
builder.IsDirectory = true;
Uri uri = client.GenerateSasUri(builder);

  1. call Azurite
    var client = new DataLakeDirectoryClient(sasUrl, dataLakeClientOptions);
    DataLakeFileClient file = client.GetFileClient(path);
    file. xxxx

If possible, please provide the debug log using the -d parameter, replacing <pathtodebuglog> with an appropriate path for your OS, or review the instructions for docker containers:
2024-04-24T08:51:37.871Z 4c638e1a-c673-4a66-ab74-f639b9e872ed error: ErrorMiddleware: ErrorName=UnsupportedRequestError ErrorMessage=Incoming URL doesn't match any of swagger defined request patterns. ErrorHTTPStatusCode=400 ErrorHTTPStatusMessage=undefined ErrorHTTPHeaders=undefined ErrorHTTPBody=undefined ErrorStack="UnsupportedRequestError: Incoming URL doesn't match any of swagger defined request patterns.\n at dispatchMiddleware (C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\dist\src\blob\generated\middleware\dispatch.middleware.js:41:30)\n at C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\dist\src\blob\generated\ExpressMiddlewareFactory.js:50:47\n at Layer.handle [as handle_request] (C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\layer.js:95:5)\n at trim_prefix (C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\index.js:328:13)\n at C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\index.js:286:9\n at Function.process_params (C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\index.js:346:12)\n at next (C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\index.js:280:10)\n at blobStorageContextMiddleware (C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\dist\src\blob\middlewares\blobStorageContext.middleware.js:137:5)\n at C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\dist\src\blob\middlewares\blobStorageContext.middleware.js:15:16\n at Layer.handle [as handle_request] (C:\Users\luyue\AppData\Roaming\npm\node_modules\azurite\node_modules\express\lib\router\layer.js:95:5)"
2024-04-24T08:51:37.871Z 4c638e1a-c673-4a66-ab74-f639b9e872ed error: ErrorMiddleware: Set HTTP code: 400

-d "<pathtodebuglog>"

Please be sure to remove any PII or sensitive information before sharing!
The debug log will log raw request headers and bodies, so that we can replay these against Azurite using REST and create tests to validate resolution.

Have you found a mitigation/solution?

No

Could you help investigate why the Azurite always return 400?

@blueww blueww self-assigned this Apr 25, 2024
@blueww blueww added blob-storage featureparity Tracking issues for catching up feature parity labels Apr 25, 2024
@blueww
Copy link
Member

blueww commented Apr 25, 2024

@luyue14

The sas you generated is with "DataLakeSasBuilder", it's datalakegen2 SAS. And you can calling datalakeGen2 API with " DataLakeDirectoryClient".

Azurite still not support datalakeGen2, so this does not work in Azurite.
From Azurite ReadMe file, you can see only blob, queue, table are supported.

We already has items to track datalakeGen2.
#553
#409

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blob-storage featureparity Tracking issues for catching up feature parity
Projects
None yet
Development

No branches or pull requests

2 participants