Download PDF documents from Amazon S3 Storage using Aspose.PDF REST API throws Bad Gateway error

We are seeing multiple timeout errors due to “Bad Gateway Occurred”. This just started today. Please advise.

Our API logs are showing this error at times: Error: DownloadFileAsync. Exception: AmazonS3 Storage exception: The specified key does not exist. Bucket ‘aspose.cloud-filestorage-prod’, FilePath

@jnugent

Could you please share some more detail about your query along with Aspose APIs that you are using?

We are using the Cloud Java SDK.

The gateway error is not consistent. I’ve attached a screenshot from our log file. Note the Amazon S3 errors mixed in with success log entries, this is not a consistent issue. Can you confirm there isn’t an issue with Amazon?
log_file.PNG (54.8 KB)

@jnugent

Please find below the complete error message. It seems the DownloadFile API method does not find the referred file and throws this error. Kindly double check your workflow, especially the process generating merge file(xxxxxxxxxxx_MergedFile_PREVIEW.pdf). It looks like it fails to generate a merge file that causes the following error.

{"RequestId":"e7e6a95c-7486-4ee5-8038-a89e5b93ad07","Error":{"Code":"errorAmazonS3Storage","Message":"AmazonS3 Storage exception: The specified key does not exist. Bucket 'aspose.cloud-filestorage-prod', FilePath '846316/6edccee8-6e4f-40a7-af47-650764cca160/a6P3i000000cOYJEA2/1620743248636_MergedFile_PREVIEW.pdf'","Description":"Operation Failed. The remote server returned an error: (404) Not Found.","DateTime":"2021-05-11T14:30:41.8198986Z","InnerError":null}}

That file does exist. I just reviewed in Aspose and can see the file. Are suggesting this could be a timing issue with the request to download?

Also, we haven’t changed anything in our code. We are seeing a number of errors today, which is unusual, so we want to understand if something changed at Aspose or Amazon that could explain the errors.

@jnugent

Yes, it seems download API tried to download the merged PDF before completion of the document merging API call. However, please check your code for this.

Apparently, we have not made any change but we are investigating it and will share our findings with you soon.

@jnugent

I am afraid we could not find any issue at the server end. We concluded that the problem was caused when you tried to access files that were not there.