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

[BUG] Unable to set a custom AWSCredentialsProvider instance #122

Open
SamuelKinnettNC opened this issue Jan 31, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@SamuelKinnettNC
Copy link

What is the bug?
In the examples, the following code is given to illustrate using a custom AWSCredentialsProvider instance with the driver:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;


String url = "jdbc:opensearch://https://remote-host-name";

Properties properties = new Properties();
properties.put("awsCredentialsProvider", new EnvironmentVariableCredentialsProvider());

Connection con = DriverManager.getConnection(url, properties);
Statement st = con.createStatement();

// use the connection

// close connection
con.close();

However, in practice this causes a null pointer exception in the setProperties function of the org.opensearch.jdbc.config.ConnectionConfig.Builder class because the getProperty method is used, which returns null if the property value is not a string. If a string is specified instead, a org.opensearch.jdbc.config.ConnectionPropertyException exception is thrown because it's expecting an AWSCredentialsProvider instance and not a string.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Implement the custom AWSCredentialsProvider example

What is the expected behavior?
The AWSCredentialsProvider instance should be correctly passed through to the driver.

What is your host/environment?

  • OS: Manjaro Linux x86_64 (Kernel 6.1.71-1-MANJARO)
  • JDK: 11
@SamuelKinnettNC SamuelKinnettNC added bug Something isn't working untriaged labels Jan 31, 2024
@marbhs
Copy link

marbhs commented Mar 13, 2024

@joshuali925 Could you please check this bug? Should it be planned for processing soon?

@Swiddis Swiddis removed the untriaged label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants