Skip to content

Can not start live query server from cli #3626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BRETT71 opened this issue Mar 13, 2017 · 16 comments
Closed

Can not start live query server from cli #3626

BRETT71 opened this issue Mar 13, 2017 · 16 comments

Comments

@BRETT71
Copy link
Contributor

BRETT71 commented Mar 13, 2017

Parse Server: 2.3.6
Server: ubuntu 14.x
I am using nginx

I am starting my Parse Server and Dashboard with pm2. The Parse Server and Dashboard work just fine. I have been trying to start a live query server but it will not start. I have tried "startLiveQueryServer": true and now I have been trying liveQueryServerOptions.

My config file that I am passing in looks like this

{
  "liveQueryServerOptions": {
    "appId": "appid",
    "masterKey": "xxxxx",
    "keyPairs": {
      "restAPIKey": "xxxxx",
      "clientKey": "xxxxx",
      "masterKey": "xxxxx"
    },
    "serverURL": "https://xxxx.com/xxxx",
    "websocketTimeout": 10000,
    "cacheTimeout": 360000,
    "logLevel": "VERBOSE"
  }
}

Everything else for parse server is being set with the env variables.

My logs show that the config and env variables are being read in but the live query server is never started.

Am I just missing something or what. Any help is greatly appreciated.

@flovilmart
Copy link
Contributor

Are you running the liveQuery server on it's own or alongside parse-server?

we're running in production with:

  "liveQuery": {
    "classNames":["partyInfo"]
  },
  "startLiveQueryServer": true,

And it's working fine.

@BRETT71
Copy link
Contributor Author

BRETT71 commented Mar 13, 2017

I am trying to get the live query server to run alongside parse server right now. From what I can tell from the parse server definitions if I use "liveQueryServerOptions" it will start a parse live query server. Do I still need to use "startLiveQueryServer"

@flovilmart
Copy link
Contributor

Yes, you should need the startLiveQueryServer option, as well as liveQuery: classNames

@BRETT71
Copy link
Contributor Author

BRETT71 commented Mar 13, 2017

I updated my config file to look like this

{
  "liveQuery": {
    "classNames":["Question", "Message"]
  },
  "startLiveQueryServer": true,
  "liveQueryServerOptions": {
    "appId": "appid",
    "masterKey": "xxxxx",
    "keyPairs": {
      "restAPIKey": "xxxxx",
      "clientKey": "xxxxx",
      "masterKey": "xxxxx"
    },
    "serverURL": "https://xxxx.com/xxxx",
    "websocketTimeout": 10000,
    "cacheTimeout": 360000,
    "logLevel": "VERBOSE"
  }
}

My environment looks like this

{
  "apps" : [{
    "name"        : "parse-server-wrapper",
    "script"      : "/usr/bin/parse-server"
    "cwd"         : "/home/parse",
    "args"         : "/home/parse/liveconfig.json",
    "env": {
      "VERBOSE": "1",
      "PARSE_SERVER_APP_NAME": "appname",
      "PARSE_PUBLIC_SERVER_URL": "https://xxxx.com/xxxx",
      "PARSE_SERVER_CLOUD_CODE_MAIN": "/home/parse/cloud/xxxx.js",
      "PARSE_SERVER_DATABASE_URI": "mongodb://xxxxxxx",
      "PARSE_SERVER_APPLICATION_ID": "appid",
      "PARSE_SERVER_MASTER_KEY": "xxxxx",
      "PARSE_SERVER_CLIENT_KEY": "xxxxx",
      "PARSE_SERVER_REST_API_KEY": "xxxxx",
      "PARSE_SERVER_MOUNT_PATH": "/xxxx"
    }
  }]
}

I am most likely missing something but I just do not know what it is.

@flovilmart
Copy link
Contributor

can you post the startup logs? Also, does it work outside PM2?

@BRETT71
Copy link
Contributor Author

BRETT71 commented Mar 13, 2017

Here is my startup output. I have not tried it yet outside of PM2

parse-server-wrapper-4 Configuration loaded from /home/parse/liveconfig.json
parse-server-wrapper-4 verbose: Support key pairs Map {
parse-server-wrapper-4   'restAPIKey' => 'xxxxx',
parse-server-wrapper-4   'clientKey' => 'xxxxx',
parse-server-wrapper-4   'masterKey' => 'xxxxx' }
parse-server-wrapper-4 appId: appid
parse-server-wrapper-4 masterKey: ***REDACTED***
parse-server-wrapper-4 port: 1337
parse-server-wrapper-4 host: 0.0.0.0
parse-server-wrapper-4 databaseURI: mongodb://xxxx
parse-server-wrapper-4 publicServerURL: https://xxxx.com/xxxx
parse-server-wrapper-4 clientKey: xxxxx
parse-server-wrapper-4 restAPIKey: xxxxx
parse-server-wrapper-4 cloud: /home/parse/cloud/xxxx.js
parse-server-wrapper-4 mountPath: /xxxx
parse-server-wrapper-4 appName: appname
parse-server-wrapper-4 userSensitiveFields: email
parse-server-wrapper-4 verbose: 1
parse-server-wrapper-4 liveQuery: {"classNames":["Question","Message"]}
parse-server-wrapper-4 startLiveQueryServer: true
parse-server-wrapper-4 liveQueryServerOptions: {"appId":"appid","masterKey":"xxxx","keyPairs":{"restAPIKey":"xxxx","clientKey":"xxxx","masterKey":"xxxxx"},"serverURL":"https://xxxx.com/xxxx","websocketTimeout":10000,"cacheTimeout":360000,"logLevel":"VERBOSE"}
parse-server-wrapper-4 serverURL: http://localhost:1337/xxxx
parse-server-wrapper-4 [14458] parse-server running on http://localhost:1337/xxxx

@flovilmart
Copy link
Contributor

The liveQuery server isn't started AFAICS

@BRETT71
Copy link
Contributor Author

BRETT71 commented Mar 13, 2017

Are there any other logs that would be outputted that would tell me why live query server is not starting

@flovilmart
Copy link
Contributor

you should see: ParseLiveQuery listening on ...

@flovilmart
Copy link
Contributor

flovilmart commented Mar 13, 2017

did you set: liveQueryPort

Actually this is not required, liveQuery should start nonetheless.

Can you make a connection from the client?

@BRETT71
Copy link
Contributor Author

BRETT71 commented Mar 13, 2017

I went into the parse-server.js in the cli folder and added two to more console logs. That is when a noticed that I have to set the "liveQueryPort". When I did that I got the ParseLiveQuery listening on (portnumber). So when you are starting a parse live query server from cli you have to set everything is that correct?

I am writing a test client with the javascript SDK to see if I can connect to it.

@flovilmart
Copy link
Contributor

You should not need to, what makes you think your liveQuery server is not started? The liveQueryServer should be able to start with sharing the parse-server express server.

Connecting from the client, you should use the ws://my-server.com/1 instead of http://... URL

@flovilmart
Copy link
Contributor

You can easily test in chrome:

> ws = new WebSocket("ws://localhost:1337/1")
// WebSocket {url: "ws://localhost:1337/1", readyState: 0, bufferedAmount: 0, onopen: null, onerror: null…}
> a.readyState == WebSocket.OPEN
// true

@flovilmart
Copy link
Contributor

In the console of the inspector

@BRETT71
Copy link
Contributor Author

BRETT71 commented Mar 13, 2017

I am getting false returned

@flovilmart
Copy link
Contributor

flovilmart commented Mar 13, 2017

I just ran it a minute ago to get that, tough to debug without more infos: is the port 1337 the right port, is /1 your mount path, what errors are spawn when trying to connect etc...

From what I can see, it works with running outside PM2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants