Skip to content

Commit ac4638c

Browse files
committed
better error handling
1 parent 6734b9b commit ac4638c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

powertools-idempotency/src/main/java/software/amazon/lambda/powertools/idempotency/persistence/DynamoDBPersistenceStore.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ private DynamoDBPersistenceStore(String tableName,
9292
// AWS_LAMBDA_INITIALIZATION_TYPE has two values on-demand and snap-start
9393
// when using snap-start mode, the env var creds provider isn't used and causes a fatal error
9494
// fall back to the default provider chain if the mode is anything other than on-demand.
95-
if (System.getenv().get(Constants.AWS_LAMBDA_INITIALIZATION_TYPE) == "on-demand") {
95+
String initializationType = System.getenv().get(Constants.AWS_LAMBDA_INITIALIZATION_TYPE);
96+
if (initializationType != null && initializationType.equals("on-demand")) {
9697
ddbBuilder.credentialsProvider(EnvironmentVariableCredentialsProvider.create());
9798
}
9899

0 commit comments

Comments
 (0)