I have a lambda function in python which worked good for a while. I tried to add CloudFront keyValueStore to the function and locally i got into an error:
[ERROR] MissingDependencyException: Missing Dependency: This operation requires an additional dependency. Use pip install botocore[crt] before proceeding.
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 56, in lambda_handler
upload_files(env, client, zip_file_path, parts[-1], user_name)
File "/var/task/lambda_function.py", line 125, in upload_files
update_keyvaluestore(env, client, values)
File "/var/task/lambda_function.py", line 239, in update_keyvaluestore
e_tag = cloudfront_keyvaluestore_client.describe_key_value_store(
File "/var/task/botocore/client.py", line 565, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/var/task/botocore/client.py", line 967, in _make_api_call
) = self._resolve_endpoint_ruleset(
File "/var/task/botocore/client.py", line 1130, in _resolve_endpoint_ruleset
auth_info = self._ruleset_resolver.auth_schemes_to_signing_ctx(
File "/var/task/botocore/regions.py", line 711, in auth_schemes_to_signing_ctx
raise MissingDependencyException(
Locally i've manage to solve this by doing pip install awscrt
But, when i created the new zip with the new dependency - i run into the same error.
I've already tried to add botocore, awscrt, boto3 folders to the zip file with all the dependencies, but it still not working.
We managed to fix it after long investigation. When creating a client you should add a config signature version 4.
for examples:
in python:
from botocore.config import Config
my_config = Config(
signature_version='v4',
)
cloudfront_keyvaluestore_client = boto3.client('cloudfront-keyvaluestore', config=my_config, region_name='us-east-1')
in NodeJS:
import '@aws-sdk/signature-v4-crt';
import { SignatureV4MultiRegion } from '@aws-sdk/signature-v4-multi-region';
const cloudFrontClient = new CloudFrontKeyValueStoreClient({
region: REGION,
signerConstructor: SignatureV4MultiRegion,
});
Thanks for the help!