mboudreau / Alternator

A mock DynamoDB that runs locally for testing purposes - DEPRECATED, PLEASE USE DYNAMODB LOCAL: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
Apache License 2.0
78 stars 39 forks source link

"Property is null" 500 response/error #94

Open jentfoo opened 9 years ago

jentfoo commented 9 years ago

I keep getting the error when querying that "property is null":

[qtp1519508707-24 - /] DEBUG o.e.jetty.server.HttpConnection - org.eclipse.jetty.server.HttpConnection$CommitCallback@664886e5 generate: DONE ([p=128,l=128,c=8192,r=0],[p=210,l=210,c=8192,r=0],true)@END [Test worker] DEBUG o.a.h.i.conn.DefaultClientConnection - Receiving response: HTTP/1.1 500 Server Error [Test worker] DEBUG org.apache.http.headers - << HTTP/1.1 500 Server Error [Test worker] DEBUG org.apache.http.headers - << Content-Type: text/plain; charset=ISO-8859-1 [Test worker] DEBUG org.apache.http.headers - << Content-Length: 210 [Test worker] DEBUG org.apache.http.headers - << Server: Jetty(9.0.7.v20131107) [qtp1519508707-24 - /] DEBUG o.s.w.s.m.a.AnnotationMethodHandlerAdapter - Written [{"__type":"com.amazonaws.dynamodb.v20111205#InternalServerErrorException","message":"The following Errors occured: property value is null.\n (Service: null; Status Code: 0; Error Code: null; Request ID: null)"}] as "text/plain;charset=ISO-8859-1" using [org.springframework.http.converter.StringHttpMessageConverter@7c8169f5] [Test worker] DEBUG c.a.http.impl.client.SdkHttpClient - Connection can be kept alive indefinitely [qtp1519508707-24 - /] DEBUG o.s.web.servlet.DispatcherServlet - Null ModelAndView returned to DispatcherServlet with name 'org.springframework.web.servlet.DispatcherServlet-2a793ae0': assuming HandlerAdapter completed request handling [qtp1519508707-24 - /] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request [Test worker] DEBUG com.amazonaws.requestId - x-amzn-RequestId: not available [qtp1519508707-24 - /] DEBUG org.eclipse.jetty.server.Server - RESPONSE / 500 handled=true [Test worker] DEBUG org.apache.http.wire - << "{"__type":"com.amazonaws.dynamodb.v20111205#InternalServerErrorException","message":"The following Errors occured: property value is null.\n (Service: null; Status Code: 0; Error Code: null; Request ID: null)"}" [qtp1519508707-24] DEBUG org.eclipse.jetty.http.HttpParser - reset HttpParser{s=END,267 of 267}

Any ideas what property it may be referencing? I pretty confident this is a bug in Alternator since the code works flawlessly against amazon's local dynamo instance.

mboudreau commented 9 years ago

What's the code that you ran?

On Tue, Jul 21, 2015, 12:48 AM Mike Jensen notifications@github.com wrote:

I keep getting the error when querying that "property is null":

08:44:08.086 [qtp1519508707-24 - /] DEBUG o.e.jetty.server.HttpConnection

  • org.eclipse.jetty.server.HttpConnection$CommitCallback@664886e5 generate: DONE ([p=128,l=128,c=8192,r=0],[p=210,l=210,c=8192,r=0],true)@END 08:44:08.086 [Test worker] DEBUG o.a.h.i.conn.DefaultClientConnection - Receiving response: HTTP/1.1 500 Server Error 08:44:08.086 [Test worker] DEBUG org.apache.http.headers - << HTTP/1.1 500 Server Error 08:44:08.086 [Test worker] DEBUG org.apache.http.headers - << Content-Type: text/plain; charset=ISO-8859-1 08:44:08.086 [Test worker] DEBUG org.apache.http.headers - << Content-Length: 210 08:44:08.086 [Test worker] DEBUG org.apache.http.headers - << Server: Jetty(9.0.7.v20131107) 08:44:08.086 [qtp1519508707-24 - /] DEBUG o.s.w.s.m.a.AnnotationMethodHandlerAdapter - Written [{"__type":"com.amazonaws.dynamodb.v20111205#InternalServerErrorException","message":"The following Errors occured: property value is null.\n (Service: null; Status Code: 0; Error Code: null; Request ID: null)"}] as "text/plain;charset=ISO-8859-1" using [org.springframework.http.converter.StringHttpMessageConverter@7c8169f5] 08:44:08.086 [Test worker] DEBUG c.a.http.impl.client.SdkHttpClient - Connection can be kept alive indefinitely 08:44:08.086 [qtp1519508707-24 - /] DEBUG o.s.web.servlet.DispatcherServlet - Null ModelAndView returned to DispatcherServlet with name 'org.springframework.web.servlet.DispatcherServlet-2a793ae0': assuming HandlerAdapter completed request handling 08:44:08.086 [qtp1519508707-24 - /] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request 08:44:08.086 [Test worker] DEBUG com.amazonaws.requestId - x-amzn-RequestId: not available 08:44:08.086 [qtp1519508707-24 - /] DEBUG org.eclipse.jetty.server.Server
  • RESPONSE / 500 handled=true 08:44:08.086 [Test worker] DEBUG org.apache.http.wire - << "{"__type":"com.amazonaws.dynamodb.v20111205#InternalServerErrorException","message":"The following Errors occured: property value is null.\n (Service: null; Status Code: 0; Error Code: null; Request ID: null)"}" 08:44:08.086 [qtp1519508707-24] DEBUG org.eclipse.jetty.http.HttpParser - reset HttpParser{s=END,267 of 267}

Any ideas what property it may be referencing? I pretty confident this is a bug in Alternator since the code works flawlessly against amazon's local dynamo instance.

— Reply to this email directly or view it on GitHub https://github.com/mboudreau/Alternator/issues/94.

jentfoo commented 9 years ago

The code that I originally produced this from is proprietary and pretty complicated.

However I was able to create a smaller example which reproduces this: https://gist.github.com/jentfoo/9bec96163e2f4085a3c4

rrutt commented 9 years ago

You have run into limitations in Alternator due to its internal use of DynamoDB version 1 functionality.

More advanced DynamoDB version 2 functionality, such as your query expression string, are NOT supported.

Alternator maps V2 requests into equivalent V1 structures, runs V1 emulation logic, and then maps V1 results to V2 structures.

The "null" property in question is the HashKey field and value for the query. Alternator is not able to map your V2 query expression into a compatible V1 query request.

I was able to trace the location of the "property value is null" error by copying your example logic into a new Unit test method in the AlternatorQueryTest in the com.michelboudreau.testv2 package in a temporary local branch of the Alternator GitHub project. I also set this constant to 'false' in the AlternatorTest base class to allow breakpoint debugging inside Alternator's code:

static boolean RUN_DB_AS_SERVICE = false;

If you still wish to use Alternator for development of your project, you will need to change how you define queries. For examples of V2-to-V1 compatible queries, see the com.michelboudreau.testv2.AlternatorQueryTest Junit test class and its AlternatorTest base class:

https://github.com/mboudreau/Alternator/blob/master/src/test/java/com/michelboudreau/testv2/AlternatorQueryTest.java

https://github.com/mboudreau/Alternator/blob/master/src/test/java/com/michelboudreau/testv2/AlternatorTest.java

jentfoo commented 9 years ago

Thanks for the info and continual help @rrutt ...sorry it took me so long to msg back.

I was able to update most of our code to work within these restrictions. I am very happy to be able to use this library for much more robust unit testing. However I do think this would be a nice improvement in the library (though it also seems like it might be a lot of work). If you want you can close this issue, or feel free to keep it open as a possible improvement.