Open kjl-dev opened 5 years ago
I had a similar problem, adding .withTypeConverterFactory(DynamoDBTypeConverterFactory.standard())
seems to have solved the issue.
@kjl-dev I tried both ways suggested above but still getting null pointer exception. Can you post your complete config?
The error is because the table name is not getting overridden while querying. Meanwhile it is already taken care for other requests. So I was able to work around over that issue by registering a custom AWS Request handler.
public RequestHandler2 requestHandler2() {
return new RequestHandler2() {
@Override
public AmazonWebServiceRequest beforeExecution(AmazonWebServiceRequest request) {
if (request instanceof QueryRequest)
((QueryRequest) request).setTableName(tableName);
return super.beforeExecution(request);
}
};
}
@kjl-dev I tried both ways suggested above but still getting null pointer exception. Can you post your complete config?
you also need to add
@EnableDynamoDBRepositories(dynamoDBMapperConfigRef = "dynamoDBMapperConfig")
at AwsConfiguration class level.
@CyberDracula had the same problem. Your hint was my solution :) Thank you!
Querying a Global Secondary Index will fail if using an overriding DynamoDBMapperConfig that doesnt specify a ConversionSchema and TypeConverterFactory.
Expected Behavior
Querying a Global Secondary Index will not fail if using an overriding DynamoDBMapperConfig that doesnt specify a ConversionSchema and TypeConverterFactory (perhaps by using reasonable defaults).
OR
An appropriate exception is thrown indicating an invalid configuration.
Actual Behavior
Querying a Global Secondary Index of a table when using a custom DynamoDBMapperConfig that does not specify a ConversionSchema and TypeConverterFactory fails with a NullPointerException. Searches on the regular table itself execute correctly.
Steps to Reproduce the Problem
Specifications
Additional Information
spring.main.allow-bean-definition-overriding