Skip to content
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

subscribe Error #93

Open
kkbpower opened this issue Jan 2, 2019 · 10 comments
Open

subscribe Error #93

kkbpower opened this issue Jan 2, 2019 · 10 comments

Comments

@kkbpower
Copy link

kkbpower commented Jan 2, 2019

ParseQuery query = ParseQuery.getQuery("Chat");
client = ParseLiveQueryClient.Factory.getClient();
SubscriptionHandling subscriptionHandling = client.subscribe(query);

What is this error?

E/ParseLiveQueryClient: Error handling message
com.parse.LiveQueryException$InvalidResponseException: {"op":"error","error":"Key in request is not valid","code":4,"reconnect":true}
at com.parse.ParseLiveQueryClientImpl.parseMessage(ParseLiveQueryClientImpl.java:268)
at com.parse.ParseLiveQueryClientImpl.access$000(ParseLiveQueryClientImpl.java:24)
at com.parse.ParseLiveQueryClientImpl$1.call(ParseLiveQueryClientImpl.java:201)
at com.parse.ParseLiveQueryClientImpl$1.call(ParseLiveQueryClientImpl.java:199)
at bolts.Task$4.run(Task.java:357)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:776)

Help me plz!

@mmimeault
Copy link
Contributor

Key in request is not valid

Did you initialized parse with your API key ?

@kkbpower
Copy link
Author

kkbpower commented Jan 3, 2019

Sure. I did initialization in my custom application. So I used the cloud call!

@mmimeault
Copy link
Contributor

You should only need

        Parse.Configuration build = new Parse.Configuration.Builder(this)
                .applicationId(applicationId)
                .clientKey(clientKey)
                .server(serverUrl)
                .build();
        Parse.initialize(build);

This is source of the error triggered in the server
https://github.com/parse-community/parse-server/blob/ce7ff2ca441da2956f779e7d41dc42da2db01c7d/src/LiveQuery/ParseLiveQueryServer.js#L576-L580
https://github.com/parse-community/parse-server/blob/ce7ff2ca441da2956f779e7d41dc42da2db01c7d/src/LiveQuery/ParseLiveQueryServer.js#L609-L622

It seem to be an issue with the valid keys you are using.

@flovilmart Is it an issue why the parse live query server configuration? Why would it expect a list of valid keyPairs?

@kkbpower
Copy link
Author

kkbpower commented Jan 4, 2019

My Custom Application class

Parse.Configuration.Builder parseConfigBuilder = new Parse.Configuration.Builder(this);
parseConfigBuilder.applicationId(applicationId);
parseConfigBuilder.clientKey(clientKey);
parseConfigBuilder.server(myServerURL);
Parse.initialize(parseConfigBuilder.build());

I am using many cloud call and it's okay.
But only occurred error about live query.
So when I tried to implement live query on mac os app by objective c, It was okay.

@rommansabbir
Copy link
Member

Check this working project
https://github.com/rommansabbir/ParseLiveQueryAndroid

@kkbpower
Copy link
Author

@rommansabbir I don't use Back4App!
But your answer is using the Back4App.

@rommansabbir
Copy link
Member

@kkbpower You need parse live query service right? I had a problem with liveQuery and i solved it. Try this if this project satisfy your problem

@kkbpower
Copy link
Author

@mmimeault I saw your links.
ParseLiveQueryServer need keypairs. javascriptKey and appId are in keypairs map variable.
But just set serverURL, appId and clientKey when I set the Parse initializationg in Android.

Is this issue ParseLiveQuery bug?

@rommansabbir

@mmimeault
Copy link
Contributor

Well on my side live query is working for 2 years now without any issue like that.
What is the version of the parse server you are using .
I will try to help you.

@dplewis
Copy link
Member

dplewis commented May 31, 2019

keyPair

A JSON object that serves as a whitelist of keys. It is used for validating clients when they try to connect to the LiveQuery server

What happens if you remove keyPair from your server config? I don't think its required to have keyPairs, where did you see that?

Can you post your server config?

As always you could also debug your server in the locations @mmimeault pointed out.

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

4 participants