Hi,
After few successful call conversions from word (docx) to html, and then I get an error.
Error while loading file ‘sourceFiles/Pre-Kindy Curriculum Guidelines_eed8cf16-3464-4d58-a61a-9c415468cb79.docx’ from storage. The specified file does not exist.
The error found in Azure application insights:
PUT /v4.0/words/Pre-Kindy%20Curriculum%20Guidelines_eed8cf16-3464-4d58-a61a-9c415468cb79.docx/saveAs
But actually the file is existed in blob container.
I use the nuget package "Aspose.Words-Cloud Version=“24.4.0”.
Here are part of code (c#).
// Retry logic
int retryCount = 0;
while (retryCount < 5) // Try a maximum of 3 attempts
{
// Since eventual consistency might be causing the file not to be available immediately after upload, consider increasing the delay before attempting the SaveAs operation.
await Task.Delay(2000); // Wait for 2 seconds before retrying
var isUploaded = await CheckBlobExistsAsync("asposecloud", blobName, _storageAccountConnectionString);
if (!isUploaded)
{
_logger.LogWarning($"Retry {retryCount + 1}: The document '{sourceFileName}' is not uploaded yet. Retrying...");
retryCount++;
continue;
}
result = await _wordsApi.SaveAs(request);
if (result?.SaveResult?.DestDocument != null)
{
break; // Success, exit loop
}
_logger.LogWarning($"Retry {retryCount + 1}: Failed to save the document. Retrying...");
retryCount++;
}
Thank you.
@pabozhi
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSCLOUD-2711
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Hi @pabozhi, thank you for your request. We analyzed the problem and did not find any failures related to the use of Azure storage and our API.
In your code example, you are using a third-party service to upload files to the storage, I think the problem is probably related to this. We recommend using only our API service to work with files in the storage, as this guarantees the success of operations at all stages.
Below I attach an code example that is worked with the case without any issues.
var wordsApi = new WordsApi(...);
var localPath = @"C:\PATH\TO\LOCAL\FILE.docx";
var remoteFileName = "Pre-Kindy Curriculum Guidelines_eed8cf16-3464-4d58-a61a-9c415468cb79.docx";
var content = File.OpenRead(localPath);
var uploadRequest = new UploadFileRequest(content, $"sourceFiles/{remoteFileName}");
await wordsApi.UploadFile(uploadRequest);
var requestSaveOptionsData = new HtmlSaveOptionsData()
{
FileName = "TestSaveAs.html"
};
var request = new SaveAsRequest(
name: remoteFileName,
saveOptionsData: requestSaveOptionsData,
folder: "sourceFiles"
);
await wordsApi.SaveAs(request);
If you need to convert in 1 API call - you can use the SaveAsOnline method as it accepts a local file as a document parameter.
If you have any other difficulties in using our API, we will be happy to help you.
Thank you for your request.
The issues you have found earlier (filed as WORDSCLOUD-2711) have been fixed in last update. This message was posted using Bugs notification tool by Ivanov_John