Aspose.Words.Cloud.Sdk.ApiException: Error while loading file '' from storage. The specified file does not exist

Hi,

We’ve been experiencing issues with Aspose.Words.Cloud SDK since this morning. Impossible to do any mail merge. I’m not sure if your upload service or mail merge service is down. Here is the code we have been using for the past 2 years:

Aspose.Words.Cloud.Sdk.WordsApi wordsApi = new(clientId, clientSecret);
var uploadRequest = new UploadFileRequest();
uploadRequest.FileContent = // My file content
uploadRequest.Path = $"/Templates/random-user-id/MailMergeTemplate.dotx";
await wordsApi.UploadFile(uploadRequest);

This results in the following:

Although it’s successful, this is not reflected in the folder structure in the dashboard (the folder remains empty).

Then, when try to make a mail merge, the file is not found and API call fails:

ExecuteMailMergeRequest mergeRequest = new();
mergeRequest.Name = "MailMergeTemplate.dotx";
mergeRequest.Folder = $"/Templates/random-user-id/";
mergeRequest.Data = dataSet.GetXml();
mergeRequest.DestFileName = $"/Results/random-user-id/MailMergeResults";

await wordsApi.ExecuteMailMerge(mergeRequest);

Please note that the API call still fails even if I manually upload the file to /Templates/random-user-id/MailMergeTemplate.dotx

This probably suggests that uploading fails, and retrieving documents from your storage also fails.

Please advise, we are getting a lot of support requests from our customer because the feature is down today.

@brokerlink.software

It seems that you are encountering an issue with the Aspose.Words.Cloud SDK where the error message indicates that the specified file does not exist during the upload process. This can often be related to the file path or the content being uploaded.

Here are a few steps you can take to troubleshoot and resolve the issue:

  1. Verify File Content: Ensure that the FileContent you are trying to upload is not null or empty. If the content is not being set correctly, the upload will fail.

  2. Check File Path: Make sure that the path you are using in the UploadFileRequest is correct. The path should include both the folder and the file name. For example:

    uploadRequest.Path = "/Templates/random-user-id/MailMergeTemplate.dotx";
    
  3. Error Handling: Implement error handling to capture any exceptions that may provide more insight into the issue. This can help you identify if the problem is with the upload service or the file itself.

  4. Review Similar Issues: There have been similar reports where users faced issues with file uploads. In one case, it was noted that an empty value for the file path parameter caused a server error. Ensure that you are providing a valid path and filename in your request.

  5. Sample Code: If the issue persists, consider sharing your complete MailMerge sample code with the support team for further assistance. This can help them replicate the issue and provide a more accurate solution.

If you continue to experience problems, it may be beneficial to check the status of the Aspose services or reach out to their support for further assistance.

Sources:
[1]: PHP SDK MailMerge 500s and File Upload 400s

Here is my response to the automated bot just in case it can help:

  1. Verify File Content : I can confirm that FileContent is not null or empty. Can’t expose the entire source code but it’s properly sent and we haven’t made any update to the procedure since July 2023 (as per git history). Also, even after uploading the file manually to the dashboard’s file storage, any subsequent mail merge requests fail (Error while loading file)
uploadRequest.FileContent = file.OpenReadStream();
  1. Check File Path : File path is correct

  2. Error Handling : No error is thrown, status: 200 is returned

  3. Review Similar Issues : Previous issues suggest restarting the services on your end

  4. Sample Code : Sample code provided

We experienced a similar issue almost 1 year ago day for day:

Sorry for the inconvenience, we are working on fixing it.

Please help. We have been generating documents without a problem for a few months. We have also started receiving unexpected errors from the Aspose API service.

Error received when downloading a file:

Raw response for the API Status code 400 { “Error”: { “Code”: “error”, “Message”: “AmazonS3 Storage exception: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.”, “Description”: “Exception of type ‘Amazon.Runtime.Internal.HttpErrorResponseException’ was thrown.” }, “RequestId”: “ec36704ef89c695bb777684d17702bfe” }

Error when merging email:
Raw response for the API Status code 404 { “Error”: { “Code”: “ErrorItemNotFound”, “Message”: “Error while loading file ‘/templates/a4/cover.docx’ from storage. The specified file does not exist.”, “Description”: “Operation Failed. File Not Found.” }, “RequestId”: “ff48fae172660d923f1ebaff008c7a44” }

image.png (18.0 KB)

Could you try it now?

Thank you Yaroslaw, the API is now behaving as expected.

Thanks, seems to be working again.
@yaroslaw.ekimov Is there any official report about the issue?

Thank you. Can you please advise what caused the issue and if this is something we can expect to occur again in the future?

We rolled back our latest release because something in AWSS3SDK started working differently in their latest version of the SDK, and we couldn’t test it because this issue is not reproducible in our current staging environment. So we will analyze and try to reproduce that issue on the updated staging environment.