Closed KarolineKarkosch closed 8 months ago
Thanks for the test cases. I'll look into a solution. Are you running these tests against real dynamo db, a fake, or local?
Thanks for the quick response! The tests ran against a real dynamoDB
I'm away for several more days, so if the need is urgent, a PR is welcome!
@KarolineKarkosch Unfortunately, I wasn't able to reproduce your issue. After adapting your tests, both pass against a real and dockerized Dynamo DB. I can't run the tests against fake dynamo, since its update expression parser isn't good enough.
Here's my adapted version of your tests in another branch. Does anything seem wrong with it? https://github.com/oharaandrew314/dynamodb-kotlin-module/blob/gh9/src/test/kotlin/io/andrewohara/dynamokt/GH9Test.kt
Hi @oharaandrew314
thanks for your response. I noticed that you are using DynamoDbEnhancedClient
instead of DynamoDbEnhancedAsyncClient
in your tests.
My assumption is that the error is caused by the asynchronous functions which may handle errors differently.
Would you mind testing it with DynamoDbEnhancedAsyncClient
in your examples?
I did try to reproduce the error without the Kotlin module but since null-Fields don't cause an error in Java, missing fields don't cause an error at all so this scenario can't happen there.
Yes, after switching to the async client, I can reproduce the scan operation running forever. You may be right that a different kind of error is expected.
@oharaandrew314 were you able to look into a solution yet?
I haven't made a breakthrough yet. It's clear that some exceptions manage to bubble out of the scan operation, but I'm not sure how that's done. I've been waiting for PRs for fake dynamo to be released so I can test more easily.
@KarolineKarkosch I've released a fix in version 0.2.4. Please let me know if it works for you!
By the way, http4k-connect-amazon-dynamodb-fake
now supports the official async SDK via an adapter from http4k-aws
. It's much faster than any test container or local dynamo. Here's an example.
Thanks a lot for the fix! Unfortunately we are currently unable to use it because we are still on Kotlin 1.6.0 and as far as I can tell the newer versions of this library requires Kotlin 1.9.0
Would it be easy for you to provide a Kotlin 1.6.0-compatible version? Otherwise we will need to wait until our service is updated before being able to test the fix :)
I should be able to lower the minimum stdlib.
On Thu, Sept 7, 2023, 3:52 a.m. KarolineKarkosch @.***> wrote:
Thanks a lot for the fix! Unfortunately we are currently unable to use it because we are still on Kotlin 1.6.0 and as far as I can tell the newer versions of this library requires Kotlin 1.9.0
Would it be easy for you to provide a Kotlin 1.6.0-compatible version? Otherwise we will need to wait until our service is updated before being able to test the fix :)
— Reply to this email directly, view it on GitHub https://github.com/oharaandrew314/dynamodb-kotlin-module/issues/9#issuecomment-1709650974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG2JSCHVUXPCPUJDEVU6ADXZF4LNANCNFSM6AAAAAA3RGQM6Y . You are receiving this because you were mentioned.Message ID: @.***>
I've downgraded the minimum stdlib to 1.4. You should be able to use it now.
@oharaandrew314 thanks for your effort! Unfortunately we are still getting the same error with version 0.3.0
:
Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.
Our assumption is that you might need to reduce the version in this line: https://github.com/oharaandrew314/dynamodb-kotlin-module/blob/8fd23bf1e0d5a358d3c3ae54eb361bc3036f523c/build.gradle.kts#L2
It seems I cannot do that. If I downgrade the Kotlin version, then the project can't compile against its own dependencies.
I'm afraid you'll just have to communicate to your team the importance of keeping your dependencies up to date.
I just checked the updateItem
- function and if I use the test provided above I still don't get an exception in case I try to update an item that does not exist. The scan
- function works fine and throws an exception in case of a defective item.
Both are tested with the DynamoDbEnhancedAsyncClient
version using the newly published 0.8.0 version of dynamodb-kotlin-module.
Can you please verify this?
This issue was fixed. The part I couldn't do was downgrade the Kotlin stdlib version for OP.
On Thu, Feb 29, 2024, 3:01 a.m. Matthias Schenk @.***> wrote:
I just checked the updateItem - function and if I use the test provided above I still don't get an exception in case I try to update an item that does not exist. The scan - function works fine and throws an exception in case of a defective item.
Both are tested with the DynamoDbEnhancedAsyncClient version using the newly published 0.8.0 version of dynamodb-kotlin-module.
Can you please verify this?
— Reply to this email directly, view it on GitHub https://github.com/oharaandrew314/dynamodb-kotlin-module/issues/9#issuecomment-1970604480, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG2JSBRWWORO6KHQTNMIR3YV3P7LAVCNFSM6AAAAAA3RGQM62VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQGYYDINBYGA . You are receiving this because you modified the open/close state.Message ID: @.***>
That means the behavior of the updateItem
- function (not throwing an exception when calling with a non-existent item) is the expected one?
I think I misunderstood your observation. I'll look into it.
You are right. It seams that it works as expected.
When a mapping error occurs (e.g. when a required field is null as in this example) the current behaviour is not as expected:
updateItem
scan
The only method behaving as expected (throwing an exception) is the query-method.
Here is an example Code detailing the problem (make sure to use a test dynamodb since the test deletes all other entities before running)