1

I'm using AWS SDK for C++ (v1.9+) in Unreal Engine to download files from S3, but I keep getting crashes in aws_cpp_sdk_core!Aws::Utils::Stream::ResponseStream::ReleaseStream()

Here's my exact code:

bool AWSBucketOperations::GetObjectAsync(
        const S3Client& ClientObject,
        const Aws::String& objectKey,
        const Aws::String& fromBucket,
        const Aws::String& outputFilePath,
        const std::function<void(const Aws::S3::Model::GetObjectOutcome& ObjectOutcome)>& callback)
    {
        Aws::S3::Model::GetObjectRequest Request;
        Request.SetBucket(fromBucket);
        Request.SetKey(objectKey);
    
        Request.SetResponseStreamFactory([=]()
        {
            return Aws::New<Aws::FStream>(
                "S3DownloadTag",
                outputFilePath,
                std::ios_base::out | std::ios_base::binary
            );
        });
        
        ClientObject->GetObjectAsync(Request,
            [callback](
                const Aws::S3::S3Client*,
                const Aws::S3::Model::GetObjectRequest&,
                const Aws::S3::Model::GetObjectOutcome& outcome,
                const std::shared_ptr<const Aws::Client::AsyncCallerContext>&)
            {
                if (outcome.IsSuccess()) {
                    callback(outcome);
                } else {
                    callback(outcome);
                }
            });
    
        return true;
    }

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.