From 48b9d5b1ebbb3a644360b76d563429864634167c Mon Sep 17 00:00:00 2001 From: SeanRoy Date: Thu, 13 Jun 2019 12:18:40 -0400 Subject: [PATCH 1/8] Ver update --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2842c7d..4ae7d0e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.seanroy lambda-maven-plugin maven-plugin - 2.3.3 + 2.3.4 lambda-maven-plugin Maven Mojo A maven plugin that deploys functions to AWS Lambda From 2f621697908683d4f486b01609fdf2a38f38c7df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2020 08:30:31 +0000 Subject: [PATCH 2/8] Bump junit from 4.12 to 4.13.1 Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1. - [Release notes](https://github.com/junit-team/junit4/releases) - [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md) - [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ae7d0e..c0587cd 100644 --- a/pom.xml +++ b/pom.xml @@ -153,7 +153,7 @@ junit junit - 4.12 + 4.13.1 test From a56b40068cf361747168e571ca99d6f20933c5a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Jun 2021 01:22:53 +0000 Subject: [PATCH 3/8] Bump httpclient from 4.5.3 to 4.5.13 Bumps httpclient from 4.5.3 to 4.5.13. --- updated-dependencies: - dependency-name: org.apache.httpcomponents:httpclient dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ae7d0e..35676f1 100644 --- a/pom.xml +++ b/pom.xml @@ -169,7 +169,7 @@ org.apache.httpcomponents httpclient - 4.5.3 + 4.5.13 com.google.code.gson From 859ac3490919656b17dc271aa51cab05a2ec4939 Mon Sep 17 00:00:00 2001 From: "gergely.juhasz" Date: Fri, 17 Sep 2021 13:56:31 +0200 Subject: [PATCH 4/8] #117 Fixed: ResourceConflictException while deploying lambda --- pom.xml | 4 ++-- .../seanroy/plugins/AbstractLambdaMojo.java | 20 +++++++++++++++++++ .../com/github/seanroy/utils/JsonUtil.java | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 4ae7d0e..a9092a5 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ - 1.11.271 + 1.12.68 UTF-8 @@ -262,7 +262,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.4 + 3.6.1 default-descriptor diff --git a/src/main/java/com/github/seanroy/plugins/AbstractLambdaMojo.java b/src/main/java/com/github/seanroy/plugins/AbstractLambdaMojo.java index a9aeb28..e6f86c7 100644 --- a/src/main/java/com/github/seanroy/plugins/AbstractLambdaMojo.java +++ b/src/main/java/com/github/seanroy/plugins/AbstractLambdaMojo.java @@ -17,6 +17,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import com.amazonaws.services.lambda.model.GetFunctionRequest; +import com.amazonaws.services.lambda.model.GetFunctionResult; import com.amazonaws.services.lambda.model.UpdateFunctionCodeRequest; import com.amazonaws.services.lambda.model.UpdateFunctionCodeResult; import com.amazonaws.services.s3.model.*; @@ -293,6 +295,24 @@ void uploadJarToS3() throws Exception { .withS3Key(fileName) .withPublish(lambdaFunction.isPublish()); UpdateFunctionCodeResult updateFunctionCodeResult = lambdaClient.updateFunctionCode(updateFunctionRequest); + + // wait until the UpdateFunctionCode finishes processing to avoid com.amazonaws.services.lambda.model.ResourceConflictException. See: https://docs.aws.amazon.com/lambda/latest/dg/functions-states.html + GetFunctionRequest getFunctionRequest = new GetFunctionRequest() + .withFunctionName(lambdaFunction.getFunctionName()); + GetFunctionResult getFunctionResult = lambdaClient.getFunction(getFunctionRequest); + + while (!getFunctionResult.getConfiguration().getState().equals("Active") + || !getFunctionResult.getConfiguration().getLastUpdateStatus().equals("Successful")) { + try { + getLog().info(String.format("UpdateFunctionCode for %s is still processing , waiting... ", lambdaFunction.getFunctionName(), getFunctionResult.getConfiguration().getState(), getFunctionResult.getConfiguration().getLastUpdateStatus())); + Thread.sleep(3000); + getFunctionResult = lambdaClient.getFunction(getFunctionRequest); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + getLog().info("UpdateFunctionCode finished successfully for " + lambdaFunction.getFunctionName()); + return lambdaFunction .withVersion(updateFunctionCodeResult.getVersion()) .withFunctionArn(updateFunctionCodeResult.getFunctionArn()); diff --git a/src/main/java/com/github/seanroy/utils/JsonUtil.java b/src/main/java/com/github/seanroy/utils/JsonUtil.java index 18a672d..907b5ee 100644 --- a/src/main/java/com/github/seanroy/utils/JsonUtil.java +++ b/src/main/java/com/github/seanroy/utils/JsonUtil.java @@ -45,6 +45,6 @@ public static String toJson(Object message) throws JsonProcessingException { } public static T fromJson(String body) throws IOException { - return mapper.readValue(body, new TypeReference>(){}); + return (T) mapper.readValue(body, new TypeReference>(){}); } } From 09f0ffb97db702b39c09b4803401b90cb508ca86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 16:01:36 +0000 Subject: [PATCH 5/8] Bump aws-encryption-sdk-java from 1.3.1 to 2.2.0 Bumps [aws-encryption-sdk-java](https://github.com/aws/aws-encryption-sdk-java) from 1.3.1 to 2.2.0. - [Release notes](https://github.com/aws/aws-encryption-sdk-java/releases) - [Changelog](https://github.com/aws/aws-encryption-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-encryption-sdk-java/compare/1.3.1...v2.2.0) --- updated-dependencies: - dependency-name: com.amazonaws:aws-encryption-sdk-java dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ae7d0e..d363a28 100644 --- a/pom.xml +++ b/pom.xml @@ -148,7 +148,7 @@ com.amazonaws aws-encryption-sdk-java - 1.3.1 + 2.2.0 junit From 9ce4beec0f55e8a997ccbe1632062580474b7a89 Mon Sep 17 00:00:00 2001 From: SeanRoy Date: Mon, 29 Nov 2021 11:36:04 -0500 Subject: [PATCH 6/8] Updated README --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f651aa..c5320bd 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ### Usage `group id: com.github.seanroy`
`artifact id: lambda-maven-plugin`
-`version: 2.3.3`
+`version: 2.3.4`


Please note that the artifact has been renamed from lambduh-maven-plugin to lambda-maven-plugin. @@ -220,6 +220,10 @@ to the file. If you add more pom's as part of enhancing the test suite, please remember to add them to .gitignore. ### Releases +2.3.4 +* Resolves [Issue 117](https://github.com/SeanRoy/lambda-maven-plugin/issues/117) https://github.com/juger89 +* Thanks [juger89@gmail.com](mailto:juger89@gmail.com) + 2.3.3 * Added Support for SQS Trigger From 8332a0cb607e802b9ed498938a00e947b01c218f Mon Sep 17 00:00:00 2001 From: SeanRoy Date: Mon, 29 Nov 2021 11:37:40 -0500 Subject: [PATCH 7/8] Updated date in notice --- NOTICE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index b8a6c84..83d341e 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Lambda Maven plugin - Copyright 2018 Sean N. Roy + Copyright 2021 Sean N. Roy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From cdfefe36b07145a89d6f147c74210d8406a5ca02 Mon Sep 17 00:00:00 2001 From: SeanRoy Date: Mon, 29 Nov 2021 20:04:25 -0500 Subject: [PATCH 8/8] Updated encryption --- src/main/java/com/github/seanroy/utils/AWSEncryption.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/seanroy/utils/AWSEncryption.java b/src/main/java/com/github/seanroy/utils/AWSEncryption.java index 045b79a..cfeb105 100644 --- a/src/main/java/com/github/seanroy/utils/AWSEncryption.java +++ b/src/main/java/com/github/seanroy/utils/AWSEncryption.java @@ -20,20 +20,20 @@ public AWSEncryption(String keyArn) { public String encryptString(String data) { // Instantiate the SDK - final AwsCrypto crypto = new AwsCrypto(); + final AwsCrypto crypto = AwsCrypto.builder().build(); // Set up the KmsMasterKeyProvider backed by the default credentials - final KmsMasterKeyProvider prov = new KmsMasterKeyProvider(keyArn); + final KmsMasterKeyProvider prov = KmsMasterKeyProvider.builder().buildStrict(keyArn); return crypto.encryptString(prov, data).getResult(); } public String decryptString(String cipherText) { // Instantiate the SDK - final AwsCrypto crypto = new AwsCrypto(); + final AwsCrypto crypto = AwsCrypto.builder().build(); // Set up the KmsMasterKeyProvider backed by the default credentials - final KmsMasterKeyProvider prov = new KmsMasterKeyProvider(keyArn); + final KmsMasterKeyProvider prov = KmsMasterKeyProvider.builder().buildStrict(keyArn); // Decrypt the data final CryptoResult decryptResult = crypto.decryptString(prov, cipherText);