realm / realm-object-server

Tracking of issues related to the Realm Object Server and other general issues not related to the specific SDK's
https://realm.io
293 stars 42 forks source link

sync error using ROS2 on https #302

Closed azraelx23 closed 6 years ago

azraelx23 commented 6 years ago

Goals

using https on realm object server 2

Expected Results

syncs fine on HTTPS

Actual Results

Steps to Reproduce

Code Sample

index.ts file:

import { BasicServer } from 'realm-object-server' import { FacebookAuthProvider } from "../node_modules/realm-object-server/dist/auth/facebook/FacebookAuthProvider" import { GoogleAuthProvider } from "../node_modules/realm-object-server/dist/auth/google/GoogleAuthProvider" import * as path from 'path'

const server = new BasicServer()

const facebookProvider = new FacebookAuthProvider() const googleProvider = new GoogleAuthProvider( { clientId: '' } )

server.start({ dataPath: path.join(__dirname, '../data'), authProviders: [ facebookProvider, googleProvider ], logLevel: 'info', https: true, httpsPort: 9443, httpsKeyPath: '/etc/letsencrypt/live/server.com/privkey.pem', httpsCertChainPath: '/etc/letsencrypt/live/server.com/cert.pem'

})
.then(() => {
    console.log(`Your server is started `, server.address)
})
.catch(err => {
    console.error(`There was an error starting your file`)
})

Version of Realm and Tooling

Logs

2017-11-07 17:16:25.780304+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connected to endpoint ‘172.104.5.72:9443’ (from ‘192.168.0.103:60023’) 2017-11-07 17:16:25.911540+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Writing failed: End of input 2017-11-07 17:16:25.911766+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connection closed due to error 2017-11-07 17:16:26.580869+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connected to endpoint ‘172.104.5.72:9443’ (from ‘192.168.0.103:60028’) 2017-11-07 17:16:26.710788+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Writing failed: End of input 2017-11-07 17:16:26.711034+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connection closed due to error 2017-11-07 17:16:27.395899+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connected to endpoint ‘172.104.5.72:9443’ (from ‘192.168.0.103:60031’) 2017-11-07 17:16:27.518827+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Writing failed: End of input 2017-11-07 17:16:27.519148+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connection closed due to error 2017-11-07 17:16:28.287810+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connected to endpoint ‘172.104.5.72:9443’ (from ‘192.168.0.103:60032’) 2017-11-07 17:16:28.412039+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Writing failed: End of input 2017-11-07 17:16:28.412334+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connection closed due to error 2017-11-07 17:16:29.191763+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connected to endpoint ‘172.104.5.72:9443’ (from ‘192.168.0.103:60033’) 2017-11-07 17:16:29.317879+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Writing failed: End of input 2017-11-07 17:16:29.318088+0200 SmartCardsPlus[29073:1925389] Sync: Connection[1]: Connection closed due to error

alebsack commented 6 years ago

Are these logs from the client? In addition, are you certain that the certificate is valid, and not issued from ACME staging servers?

azraelx23 commented 6 years ago

yes, from client side, certificates are valid since the login from client went through fine, but the actual data syncing after that has problems mentioned

bigfish24 commented 6 years ago

@azraelx23 can set the logs to debug so we can see more info? Also can you share the logs from the server?

azraelx23 commented 6 years ago

may I know where the logs are? Tried searching for it on /var/log to no avail.

also on client side, it is failing on this line of code:

Realm.asyncOpen(configuration: config, callbackQueue: DispatchQueue.main, callback: { (realm : Realm?, error : Error?) in

bigfish24 commented 6 years ago

Can you turn on higher logs for the client? If you are running with pm2 then just pm2 logs will work: http://pm2.keymetrics.io/docs/usage/log-management/

modnovolyk commented 6 years ago

Holy moly! spent whole night troubleshooting same issue. @azraelx23 check your scheme in realm URL. That should be realms instead of realm for instance realms://myros.com:9443/~/ios-app-realm

Such nuances should be clearly described in the docs.

azraelx23 commented 6 years ago

thanks @modnovolyk , appreciate it, will try it out!

bmunkholm commented 6 years ago

I'm assuming this solved your issue. Otherwise please get back.

azraelx23 commented 6 years ago

it is solved per @modnovolyk 's suggestion, thanks again!