Open jordanfowler opened 5 years ago
If I switch to using Bolt protocol, I get: RuntimeError (Unexpected message type: ignored (#<Neo4j::Core::CypherSession::Adaptors::Bolt::Message:0x00005605032e5cd0 @type_code=126, @type=:ignored, @args=[]>))
I also have this error. Runtime:
neo4j
gem version 9.3.0neo4j-core
version 8.1.4Further, the node type that is causing this error has a datetime
property created using neo4j-admin import
. When I retrieve a node using ModelClass.first
I get the same error and log output as @jordanfowler. When I retrieve it using session.query
I get:
result = sess.query('MATCH (mic:MenuItem) RETURN mic LIMIT 1')
ETHON: performed EASY effective_url=http://localhost:7474/db/data/cypher response_code=400 return_code=ok total_time=0.103544
Traceback (most recent call last):
1: from (irb):2
Neo4j::Server::CypherResponse::ResponseError (Unsupported property type: class java.time.ZonedDateTime)
There is no error in the log when retrieving using session.query
. My other node types do not generate this error on retrieval.
I can confirm that removing the datetime
property removes the error. Seems that datetime
is not yet supported by serialization on the server.
I also tested localdatetime
, which gives the same behaviour for ModelClass.first
but a slightly different error for session.query
:
2.5.1 :003 > result = sess.query('MATCH (mic:MenuItem) RETURN mic LIMIT 1')
ETHON: performed EASY effective_url=http://localhost:7474/db/data/cypher response_code=400 return_code=ok total_time=0.033486
Traceback (most recent call last):
1: from (irb):3
Neo4j::Server::CypherResponse::ResponseError (Unsupported property type: class java.time.LocalDateTime)
Turns out that neo4j 3.5.0 fixes the server issue, providing an iso8601 string for any datetime
or localtime
properties (my understanding is that iso8601 is now the official datetime format for JSON, so this is a good thing).
Unfortunately, the property type converters in the gem assume an integer value and choke on it.
Workaround is to use type: String
for these properties. Also be aware the the Ruby Time.iso8601 parser requires a seconds component in the time string, but Neo4j doesn't provide seconds on datetime
properties in JSON even though they're present in the database.
Running the following code (Geoname is a simple ActiveNode model):
produces (in Ruby):
and the Neo4j server produces this output:
Runtime information:
Neo4j database version: 3.4.6
neo4j
gem version: 9.3.0neo4j-core
gem version: 8.1.4