Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS lambda can not build S3 Client #915

Closed
ivansynyshynkindgeek opened this issue Feb 9, 2021 · 5 comments · Fixed by #944
Closed

AWS lambda can not build S3 Client #915

ivansynyshynkindgeek opened this issue Feb 9, 2021 · 5 comments · Fixed by #944

Comments

@ivansynyshynkindgeek
Copy link

Hello

I'm working on AWS lambda that should upload files to S3 bucket. Locally it works fine but when I build native image using Docker and deploy it to AWS lambda there is a problem to build S3Clien. Function to build S3Client looks like:

AmazonS3 s3Client = AmazonS3ClientBuilder
                .standard()
                .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(this.accessKeyId, this.secretKey)))
                .withRegion(Regions.EU_CENTRAL_1)
                .build();

this.accessKeyId, this.secretKey - valid values for credentials

Stracktrace looks like:

com.amazonaws.SdkClientException: Unable to load partition metadata from com/amazonaws/partitions/endpoints.json
at com.amazonaws.partitions.PartitionsLoader.build(PartitionsLoader.java:82)
at com.amazonaws.regions.RegionMetadataFactory.create(RegionMetadataFactory.java:30)
at com.amazonaws.regions.RegionUtils.initialize(RegionUtils.java:64)
at com.amazonaws.regions.RegionUtils.getRegionMetadata(RegionUtils.java:52)
at com.amazonaws.regions.RegionUtils.getRegion(RegionUtils.java:105)
at com.amazonaws.client.builder.AwsClientBuilder.getRegionObject(AwsClientBuilder.java:256)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:245)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:232)

Tried this solution: oracle/graal#1022 (comment)

It didn't help

@graemerocher
Copy link
Contributor

Need to add resource config with:

{
  "resources" : [ {
    "pattern" : "\\Qcom/amazonaws/partitions/endpoints.json\\E",
    "pattern" : "\\Qcom/amazonaws/sdk/versionInfo.properties\\E"
    }
  ]
}

@graemerocher graemerocher added the info: good first issue Good for newcomers label Feb 9, 2021
@ivansynyshynkindgeek
Copy link
Author

Tried this approach with a different versions of resource-config.json file. It resolved an issue with endpoints.json reading but not with versionInfo.properties

I created a public test repo that reproduces an issue: repo

To build an image it's enough to run ./deploy.sh

AWS lamdba should have valid environment variables AWS_S3_ACCESS_KEY_ID and AWS_S3_SECRET_KEY

Could you please take a look?

@g3blv
Copy link

g3blv commented Feb 19, 2021

@graemerocher is there any update on this issue or is more information needed?

@pgressa
Copy link
Contributor

pgressa commented Mar 2, 2021

@g3blv @ivansynyshynkindgeek for the micronaut 2.4 we use newer version of aws sdk v2 that has brings graalvm native support directly in the aws sdk module. Please feel free to validate latest 2.4-SNAPSHOT module.

@pgressa pgressa linked a pull request Mar 2, 2021 that will close this issue
@pgressa
Copy link
Contributor

pgressa commented Mar 2, 2021

@g3blv closing this one, re-open when you'll find out the issue persists.

@pgressa pgressa closed this as completed Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants