Azure / Azure/Azurite

Azurite alway return 400 when use sasUrl generate by Azurite

Open
#2,391 1 comment 0 reactions 1 assignee Claimed by @blueww View on GitHub
blob-storage featureparity
Dominant language
TypeScript
Stars
2.3k
Forks
393
Avg merge
1d 20h
Merged PRs (30d)
36

Description

### 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);

3. 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 \ 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 ""
```

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.