Comments (5)
I see in the 2 failed (400) request, the resource Uri are incorrect, they both missed the storage account name.
"RequestURL=http://localhost/testcontainer/testfile.txt?st=2024-09-09T11%3A03%3A37Z&se=..."
"RequestURL=http://localhost/favicon.ico"
The correct Uri should look like:
"RequestURL=http://localhost/devstoreaccount1/testcontainer/testfile.txt?st=2024-09-09T11%3A03%3A37Z&se=..."
"RequestURL=http://localhost/devstoreaccount1/favicon.ico"
from azurite.
I will close this issue as the problem is resolved.
Feel free to contact us again if need any further assistance on Azurite.
from azurite.
@EmmaZhu
Would you please help to look?
@root-11
Would you please share Azurite debug log (start Azurite with parameter like "--debug c:\logfile.log"), then we can do more investigation.
from azurite.
This log ends with the error. Action performed:
- attempt to upload file (file already existed in the container, so ignore this error)
- create the sas-token
- replace devstore with localhost in the url
- open incognito window to try the sas-token (fails)
from azurite.
A fully formed sas-token was craeted by including the blob service url with port for azurite and adding the storage account name as advised.
functioning example:
http://127.0.0.1:10000/devstoreaccount1/testcontainer/ok_rpi.csv?st=2024-09-10T10%3A45%3A42Z&se=2024-09-10T11%3A55%3A42Z&sp=r&spr=http&sv=2024-08-04&sr=b&sig=tYQCmhkWE3tXbFrlA15DhLwYitHKkSuj6OJmBdk3ikE%3D
For effect see:
blob_service = "127.0.0.1:10000"
sas_url = f"http://{blob_service}/{STORAGE_ACCOUNT_NAME}/{container_name}/{blob_name}?{sas_token}"
in the function below:
@app.route(route="make_sas_token")
def make_sas_token(req: func.HttpRequest) -> func.HttpResponse:
blob_name = req.params.get('filename')
#< ... cut for brevity ...>
sas_token = generate_blob_sas(
account_name=STORAGE_ACCOUNT_NAME, # Real account name for the token
container_name=container_name,
blob_name=blob_name,
account_key=STORAGE_ACCOUNT_KEY,
permission=BlobSasPermissions(read=True),
expiry=datetime.now(UTC) + timedelta(hours=1), # Token valid for 1 hour
protocol="http",
start=datetime.now(UTC) - timedelta(minutes=10),
version="2020-02-10" # Ensure this is a supported version
)
blob_service = "127.0.0.1:10000"
sas_url = f"http://{blob_service}/{STORAGE_ACCOUNT_NAME}/{container_name}/{blob_name}?{sas_token}"
return func.HttpResponse(sas_url, status_code=200)
Thank you for helping out with the missing manual!
from azurite.
Related Issues (20)
- The value for one of the HTTP headers is not in the correct format HOT 2
- Please Document Azurite Logging in VS CODE - not obvious how to see logs HOT 1
- Cannot add --skipApiVersionCheck when using testcontainers HOT 3
- Docker container is not up-to-date HOT 2
- Azurite returns 500 for all PUT requests after an unexpected client restart HOT 6
- Docker image won't stop restarting HOT 4
- Port specification not working (docker, --blobPort) HOT 1
- Block blob StageBlockWithURL isn't implemented HOT 6
- Azurite will deprecate supporting Node.js 14 in a future release.
- Azurite not recognizing accounts other than default even though prerequisites are met. HOT 2
- Azure Shared Access Signature - Signature did not match using ingress nginx HOT 4
- `Access-Control-Allow-Origin` header not set in Azurite response HOT 2
- Aspire default table HealthCheck fails with 400 bad request
- PutBlob API allows invalid metadata name with hyphen HOT 1
- Critical vulnerability in `tough-cookie` HOT 3
- Empty blob access error using Java SDK HOT 7
- Error when running azurite with host.docker.internal HOT 3
- Blobtrigger: Azure.Storage.Queues: Value cannot be null.
- Getting `error: ErrorMiddleware: Set HTTP body: undefined` when uploading a blob HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azurite.