I am tried enabling the snapstart for my lambda function which just uses a simple java AWS SDK to connect to just a put a message to the queue. Without the snapstart the code works fine, however when its enabled, I get this error
Error while submitting the message with exception :Unable to load AWS credentials from any provider in the chain
I have attached the full access policy for the SQS and its working fine without the snapstart.
final Map<String, MessageAttributeValue> messageAttributes = new HashMap<>();
messageAttributes.put("testID", new MessageAttributeValue().withStringValue("id123").withDataType("String"));
final AmazonSQS sqs = AmazonSQSClientBuilder.standard().withRegion(Regions.EU_WEST_1).build();
final SendMessageRequest sendMessageStandardQueue = new SendMessageRequest().withQueueUrl("https://sqs.eu-west-1.amazonaws.com/111111/my-queue")
.withMessageBody("Test message from lambda")
.withMessageAttributes(messageAttributes);
sqs.sendMessage(sendMessageStandardQueue);
This code works fine without enabling snapstart on the lambda function. After enabling snapstart, I just added the following on the code.
@Override
public void beforeCheckpoint(org.crac.Context<? extends Resource> context) throws Exception {
System.out.println("Before Checkpoint");
}
@Override
public void afterRestore(org.crac.Context<? extends Resource> context) throws Exception {
System.out.println("After Restore");
}
Would you please help me to understand why exactly is it unable to load the credentials. ?