Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

DynamoDb schema type error #110

Open
lipflip opened this issue Jun 14, 2021 · 3 comments
Open

DynamoDb schema type error #110

lipflip opened this issue Jun 14, 2021 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@lipflip
Copy link

lipflip commented Jun 14, 2021

Server Version : (Server v5.98)

I got this error right after the OTP validation through Android client.
I have setup the dynamodb table "message" with primary key "H" (numeric).
And I passed it in the config.yml file.

Is the primary key not correct? (found it in the source code).

What should I use?

The account validation was not successfull due to this error.

Logs

ERROR [2021-06-14 14:26:39,738] io.dropwizard.jersey.errors.LoggingExceptionMapper: Error handling a request: 464f2f04...
! com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException: One or more parameter values were invalid: Condition parameter type does not match schema type (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: T3VA85U221515OCO3739D4... ; Proxy: null)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1819)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1403)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1372)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:704)
! at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686)
! at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550)
! at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530)
! at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.doInvoke(AmazonDynamoDBClient.java:6164)
! at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:6131)
! at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.executeQuery(AmazonDynamoDBClient.java:3896)
! at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.query(AmazonDynamoDBClient.java:3861)
! at com.amazonaws.services.dynamodbv2.document.internal.QueryCollection.firstPage(QueryCollection.java:53)
! at com.amazonaws.services.dynamodbv2.document.internal.PageIterator.next(PageIterator.java:45)
! at com.amazonaws.services.dynamodbv2.document.internal.IteratorSupport.nextResource(IteratorSupport.java:87)
! at com.amazonaws.services.dynamodbv2.document.internal.IteratorSupport.hasNext(IteratorSupport.java:55)
! at org.whispersystems.textsecuregcm.storage.AbstractDynamoDbStore.writeInBatches(AbstractDynamoDbStore.java:85)
! at org.whispersystems.textsecuregcm.storage.MessagesDynamoDb.deleteRowsMatchingQuery(MessagesDynamoDb.java:231)
! at org.whispersystems.textsecuregcm.storage.MessagesDynamoDb.lambda$deleteAllMessagesForAccount$5(MessagesDynamoDb.java:197)
! at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:79)
! at org.whispersystems.textsecuregcm.storage.MessagesDynamoDb.deleteAllMessagesForAccount(MessagesDynamoDb.java:192)
! at org.whispersystems.textsecuregcm.storage.MessagesManager.clear(MessagesManager.java:90)

@lipflip lipflip added the help wanted Extra attention is needed label Jun 14, 2021
@dotneutron
Copy link

dotneutron commented Jun 14, 2021

@lipflip The table used by class MessagesDynamoDb should also have a sort key S by the looks of it. Could you share the setup you've created so far?

Edit: Not sure the partition key H should be numeric either, since it's doing a conversion to bytes in MessagesDynamoDb#deleteAllMessagesForAccount. So I guess it could be of type Binary.

final byte[] partitionKey = convertPartitionKey(destinationAccountUuid);

@tshaheer
Copy link

tshaheer commented Aug 6, 2021

@lipflip Did you solve this.

@trocher
Copy link

trocher commented Nov 12, 2021

Hey @dotneutron and @tshaheer

some updates on that that might help :

in the AWS console

For messageDb :

  • Partition key : H (Binary)
  • Sort key : S (Binary)
  • Create a secondary index with the following parameters:
    • Name : Message_UUID_Index
    • Sort key : U (Binary)

For keysDb :

  • Partition key : U (Binary)
  • Sort key : DK (Binary)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants