cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Swift Theo Driver 4.0 not connecting to bolt

I am attempting to connect to Neo4j 4.0 (both a desktop install and a Ubuntu (20.04) server install) using the latest Theo driver. Have read many threads and have checked all the key points are correct re changing neo4j.conf (default_listen_address to 0.0.0.0, connector.bolt.enabled=true); have tried with both security.auth_enabled=false and true, but not able to connect.

I am able to connect to the ubuntu instance from desktop browser no issue, and can connect via cypher-shell on the ubuntu box.

debug log: {o.n.b.r.DefaultBoltConnection] The client is unauthorised due to authentication failure; this shows each time the Theo code attempts to contact ubuntu instance

TCPdump shows the same 8 exchanges for both desktop and ubuntu connection attempt:
.244 is the iPhone with Theo, .179 is the desktop version. Seems that (if I understand the flags correctly...) the initial handshake goes ok (first three lines [S}, [S.], [.]) and login info is sent in line 4 however Neo ends the connection in lines 5 and 6.

  1. 11:29:58.628269 IP 192.168.197.244.60667 > 192.168.197.179.7687: Flags [S], seq 2260321034, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 1215516539 ecr 0,sackOK,eol], length 0

  2. 11:29:58.628439 IP 192.168.197.179.7687 > 192.168.197.244.60667: Flags [S.], seq 949373330, ack 2260321035, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 2516663799 ecr 1215516539,sackOK,eol], length 0

  3. 11:29:58.633165 IP 192.168.197.244.60667 > 192.168.197.179.7687: Flags [.], ack 1, win 2058, options [nop,nop,TS val 1215516546 ecr 2516663799], length 0

  4. 11:29:58.633168 IP 192.168.197.244.60667 > 192.168.197.179.7687: Flags [P.], seq 1:518, ack 1, win 2058, options [nop,nop,TS val 1215516546 ecr 2516663799], length 517

  5. 11:29:58.633205 IP 192.168.197.179.7687 > 192.168.197.244.60667: Flags [.], ack 518, win 2050, options [nop,nop,TS val 2516663802 ecr 1215516546], length 0

  6. 11:29:58.634780 IP 192.168.197.179.7687 > 192.168.197.244.60667: Flags [F.], seq 1, ack 518, win 2050, options [nop,nop,TS val 2516663804 ecr 1215516546], length 0

  7. 11:29:58.653512 IP 192.168.197.244.60667 > 192.168.197.179.7687: Flags [.], ack 2, win 2058, options [nop,nop,TS val 1215516564 ecr 2516663804], length 0

  8. 11:29:58.653978 IP 192.168.197.244.60667 > 192.168.197.179.7687: Flags [R.], seq 518, ack 2, win 2058, length 0

I added a breakpoint in Xcode and the parameters passed to Neo are correct (ip, port, username, pw).

Given that the tcpdump appears to show comms happening 'normally' - i.e. the authentication info actually is not correct, I am assuming that the issue is related to (a) a config I am missing somewhere to allow authentication, or (b) Theo is not correctly passing info to Neo or maybe (c) Theo only works with Enterprise Edition?

Any help/clues would be greatly appreciated!!

8 REPLIES 8

What's Theo driver? What's Theo?
Can we see your code?

The version of neo4j you are using and the version of your driver must fit.

I believe the active repository for Swift is GitHub - Neo4j-Swift/Neo4j-Swift: Open Source Neo4j driver for iOS, tvOS, Linux and macOS. Is that the one you are using, @lussierm?

Hello Gabriel/Florent,
Thanks for replying.

I am using the Theo driver mentioned in this link Theo 4.0 Release: The Swift Driver for Neo4j which points to the GitHub repository mentioned in your note. I have installed the package, including the Theo-Example app which is what I am using to attempt to connect. Xcode 12.3; the package loads/builds no problem. iPhone 12.

Thanks...
Mike

SOLVED:
Communicated with Niklas Sears (co-author of Theo) and there is a 5.2.1 branch that corrects the issue. I have adjusted a few lines of code in the Theo-example QueryViewController.swift as follows:
if let config = connectionConfig {
do {
self.theo = try BoltClient(
hostname: config.host,
port: config.port,
username: config.username,
password: config.password,
//encrypted: true) Theo 5.2.0

                //Theo 5.2.1 encryption options (see ClientConfigurationProtocol)
                //encryption: Encryption.certificateIsSelfSigned
                //encryption: Encryption.certificateTrusted(certificatePath: <#T##String#>)
                //encryption: Encryption.certificateTrustedByAuthority
                encryption: Encryption.unencrypted)

This small change solved the connection issue (unencrypted connection).

I am having the same issue and I cannot find the 5.2.1 branch. Can you provide a link to the branch?
Thank you,
Rod

Hello Rod. It is located here: GitHub - Neo4j-Swift/Neo4j-Swift at dev/5.2.1

Thank you very much. Do you know when this will make into the main branch?

Hi Rod,
I do not; you could reach out directly to Niklas - he may be able to give more info. I found him at Niklas Saers niklas@saers.com.

Mike