-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Azure RemoteCache: Error: File download response doesn't contain valid content length header #30018
Comments
Oh no, thanks for the report! I'll investigate this right away. For your first issue with I'm also going to change the functionality to check for the existence of You can run As for your second issue, I'm having a hard time reproducing that, so maybe it is related to the failed initialization. But the config for azure shouldn't have the |
Thx for investigating that this fast, i appreciate! I can confirm running
I saw that basically every answer given will be persisted into But sadly the error stays the same. As you can see I'm using a connection string with a SAS instead of account name and key. But I also tested it with an account name and key based connection string inside Is there anything I can provide? |
@mmslakr can you share the settings you have setup for the SAS token? |
But we maybe don't need to focus to much on SAS. It's problem with an accountKey-based connection string as well. I just discovered that the second console.log (the download blob response) is different if I use the accountKey-based connection string:
The response body:
That's clearly an authentication problem (even a strange one) whereas the SAS-based connection string told us that the blob does not exist. |
That is a very weird error for sure. I know we should handle that error, so the run wouldn't fail if we get it. But we'd see a warning if we try to write to the remote cache if we cant authenticate. I'll do a quick search to see what that error means. And FYI, you can do |
From what i found regarding the error.. is to try and make sure that the account name or account key are properly URL encoded. So if there are any |
Thx for hinting I copied the connection string from the "Access Keys" Azure portal page. I remember it contained some % chars that indicate encoding. But I'll check that tomorrow as first. |
Sorry, just now saw that i used my private account @kraiz for the last comment. So it's me as well. Nevermind.
And the account key does not contain I also rotated the account key multiple times and the error stays the same. |
Here's a quick test script to see if you're able to download properly. You can put this in the same workspace that has the azure cache plugin, as it will have the right dependencies. Change the consts at the top to your specific use case, then you can run it with //@ts-check
const { BlobServiceClient } = require("@azure/storage-blob");
const fs = require("fs");
const CONNECTION_STRING =
process.env.AZURE_STORAGE_CONNECTION_STRING ??
"DefaultEndpointsProtocol=https;AccountName=ACCOUNT_NAME;AccountKey=ACCOUNT_KEY;EndpointSuffix=core.windows.net";
const CONTAINER_NAME = "nxcache";
const BLOB_NAME = "test";
async function main() {
const blobServiceClient =
BlobServiceClient.fromConnectionString(CONNECTION_STRING);
const containerClient = blobServiceClient.getContainerClient(CONTAINER_NAME);
const blobClient = containerClient.getBlockBlobClient(BLOB_NAME);
const downloadResponse = await blobClient.download();
const outputFilePath = "downloaded_test";
await new Promise((resolve, reject) => {
const writeStream = fs.createWriteStream(outputFilePath);
downloadResponse.readableStreamBody?.pipe(writeStream);
writeStream.on("finish", resolve);
writeStream.on("error", reject);
});
console.log(`File downloaded to ${outputFilePath}`);
}
main()
.catch(console.error)
.finally(() => process.exit(0)); Do you still get authentication errors with this script? |
Your script delivers a perfectly valid 404 "BlobNotFound" (for both accountKey and SAS based connection string). I changed the storage-blob import to:
and boom, this resulted in:
So I have different versions:
// package.json
{
"resolutions": {
"@nx/powerpack-azure-cache/@azure/storage-blob": "12.18.0"
}
} Seem like i need to find out what's wrong with the latest |
Hmm interesting. I'll see if I can reproduce that and get the same error. |
Current Behavior
I'm trying to setup the Azure blob storage based Powerpack RemoteCache and ran into some problems:
Initializing @nx/powerpack-azure-cache...
Is failing. I'm not sure why. I've gone ahead:The first stack line points to this
@azure/storage-blob
code:I added the 2
console.log
and the first indicated that the credentials fromAZURE_STORAGE_CONNECTION_STRING
are used as expected. The second console log:The body is expected as well as I'm trying to make it work the container is still empty. As the
@nx/powerpack-azure-cache
code is highly obfuscated I couldn't check but it seems it didn't handle this case correctly.I wonder if I did the setup wrong because that's clearly not an edge case. Is that just an follow-up problem of the failed initialization?
Expected Behavior
$ nx test emulator
Should detect the blob does not yet exist, run the task and upload a new blob.
GitHub Repo
No response
Steps to Reproduce
Already metioned above.
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: