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

getting error Caused by: com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment . #145

Open
jangid21 opened this issue Jun 10, 2022 · 0 comments

Comments

@jangid21
Copy link

Hi, I am trying to upgrade the spring boot to 2.6.6 I am trying to use zalando library for aws kms implementation. but it is failing in decryption process. getting error

"Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kms' defined in class path resource [de/zalando/spring/cloud/config/aws/kms/KmsEncryptionConfiguration$KmsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.kms.AWSKMS]: Factory method 'kms' threw exception; nested exception is com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.kms.AWSKMS]: Factory method 'kms' threw exception; nested exception is com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
Caused by: com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
"

I have one controller class.

import com.logmein.ucc.Application;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@EnableAutoConfiguration
@RestController
public class DemoController {

// @SuppressWarnings("unused")
// @Autowired
// private TextEncryptor encryptor;

@Value("${not.secret}")
private String notSecret;

@Value("${yes.secret}")
private String yesSecret;

@RequestMapping("/secret")
public String testConfiguration() {
    // values that start with {cipher} are automatically decrypted. Or you
    // can use the injected encryptor to encrypt/decrypt text on the fly.
    //String decrypted = encryptor.decrypt("Another secret");
    return String.format("No Secret = %s<br/>Secret = %s", notSecret, yesSecret);
}

public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
}

I have added secrets in the application.properties

not.secret=Not Secret
yes.secret={cipher}AQECAHgC4i08YQPWUmjDPAmJr78ypSphQy+cO9D/UNvsgKmjNAAAAGgwZgYJKoZIhvcNAQcGoFkwVwIBADBSBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHWhtF95tvJzwtncNQIBEIAlTrYDV6TI1FwKPMCuUYMt6wsYLEE+f7uQkZ0Kcx6nPMjd57VNEA==

can anyone suggest how to resolve this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant