Skip to content

C++ Lambda - segmentation fault

0

Hi,

I am trying to create a lambda function with access to an S3 bucket and allow operations to the bucket such as create and delete files (the usual I assume).

I installed (on my windows pc) a WSL instance of ubuntu 20.04 and I installed AWS CLI according to: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.htm

I then followed the guide to configure and set access keys: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html

Now, I followed the guide on creating a hello world lambda function in c++: https://aws.amazon.com/blogs/compute/introducing-the-c-lambda-runtime/

The first example, all is fine and the lambda function successfully runs from the aws console without any errors or warnings.

Now, when I continue the same guide to the "beyond hello", things start going wrong. I successfully setup all what was needed and installed the SDK's as required. Now, when I try to make the project, the compiler stops with this message:

cpp-encoder-example/main.cpp:78:56: error: no matching function for call to ‘Aws::S3::S3Client::S3Client(std::shared_ptr<Aws::Auth::EnvironmentAWSCredentialsProvider>&, Aws::Client::ClientConfiguration&)’
   78 |         S3::S3Client client(credentialsProvider, config);

followed by a few lines with this note where n = 5, 4 and 1. (line number is of the first warning thrown)

include/aws/s3/S3Client.h:96:9: note:   candidate expects n arguments, 2 provided

Now, when I remove 'credentialsProvider' from S3::S3Client client(credentialsProvider, config); in main.cpp, all does compile. (should that work?)

However, I then continue to create the lambda function and when created and I press test in the aws console, it stops with:

s2n_init() failed: 402653268 (Failed to load or unload an openssl provider)
Fatal error condition occurred in /home/username/aws-sdk-cpp/crt/aws-crt-cpp/crt/aws-c-io/source/s2n/s2n_tls_channel_handler.c:197: 0 && "s2n_init() failed"
Exiting Application
No call stack information available
START RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Version: $LATEST
2022-11-21T09:02:07.642Z xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Task timed out after 1.02 seconds

END RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
REPORT RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx  Duration: 1015.50 ms    Billed Duration: 1000 ms    Memory Size: 128 MB Max Memory Used: 16 MB 

Now, for some reason I think something is failing during compile time with the certificates. What certificates may I not have set correctly, what installation step might I have missed? Have I failed at something else and can someone give me a pointer (pun not intended) to what to do / try?

Ps. I'm not sure what tags to add since sdk or c++ are not included in them.

1 Answer

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.