Skip to content

com.parse.ParseRequest$ParseRequestException: invalid key name: 0 #68

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
mghohoo opened this issue Jan 30, 2016 · 9 comments
Closed

com.parse.ParseRequest$ParseRequestException: invalid key name: 0 #68

mghohoo opened this issue Jan 30, 2016 · 9 comments

Comments

@mghohoo
Copy link

mghohoo commented Jan 30, 2016

i got a exception as title(on android).it works with parse.com.
houseQuery.whereEqualTo("Customer", CloudCustomer.getCurrent()); houseQuery.findInBackground(new FindCallback<CloudHouse>() { @Override public void done(List<CloudHouse> houses, ParseException e) { if (houses==null) e.printStackTrace(); });

@lacker
Copy link
Contributor

lacker commented Jan 30, 2016

Hmm not sure but this feels like an error somewhere in your code. Can you reproduce this in a unit test?

@mkpazon
Copy link

mkpazon commented Jan 31, 2016

@lacker I am also getting the error. I login with Facebook and then try to execute any query and keep on getting this error.

{"code":105,"error":"invalid key name: 0"}

@mghohoo
Copy link
Author

mghohoo commented Jan 31, 2016

app.js

`express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();
// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
databaseURI: 'mongodb://localhost:27017/test',
cloud: '', // Provide an absolute path
appId: 'myAppId',
javascriptKey: 'myJavascriptKey',
masterKey: 'mySecretMasterKey',
fileKey: 'optionalFileKey',
clientKey:'myClientKey'
});
// Serve the Parse API on the /parse URL prefix
app.use('/', api);
// Hello world
app.get('/hello', function(req, res) {
res.status(200).send('Express is running here.');
});
var port = process.env.PORT || 1337;
app.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');

});`

public void test() throws Exception {
    Parse.initialize(
            new Parse.Configuration.Builder(this.getContext())
                    .applicationId("myAppId")
                    .clientKey("myClientKey")
                    .server("http://myhost.com:1337")
                    .enableLocalDataStore()
                    .build());
    ParseQuery<ParseObject>query=ParseQuery.getQuery("Customer");
    query.whereContains("Name","name");
    assertEquals(query.count(), 1);
}

Running tests
Test running started
com.parse.ParseRequest$ParseRequestException: invalid key name: 0
at com.parse.ParseRequest.newPermanentException(ParseRequest.java:270)
at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:301)
at com.parse.ParseRequest$3.then(ParseRequest.java:137)
at com.parse.ParseRequest$3.then(ParseRequest.java:133)
at bolts.Task$15.run(Task.java:917)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:908)
at bolts.Task.continueWithTask(Task.java:715)
at bolts.Task.continueWithTask(Task.java:726)
at bolts.Task$13.then(Task.java:818)
at bolts.Task$13.then(Task.java:806)
at bolts.Task$15.run(Task.java:917)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

@mkpazon
Copy link

mkpazon commented Jan 31, 2016

The problem seems to be due to JSON handling.
The client sends the following JSON in the body
{"where":"{\"status\":200,\"user\":{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"F2ozm6Hgew\"}}","count":"1","_method":"GET"}

but the parse-server returns an error.

Changing the above JSON to the following is successful
{"where": {"status":200,"user":{"__type":"Pointer","className":"_User","objectId":"F2ozm6Hgew"}},"count":"1","_method":"GET"}

@smanikandan14
Copy link

Reported similar issue observed on the Android-SDK side. parse-community/Parse-SDK-Android#383 . Not sure if this is a client side sdk or parse-server

@gfosco
Copy link
Contributor

gfosco commented Feb 1, 2016

Merged #105 and hope this is fixed. 👍

@gfosco gfosco closed this as completed Feb 1, 2016
@mghohoo
Copy link
Author

mghohoo commented Feb 2, 2016

test passed 👍

montymxb pushed a commit to montymxb/parse-server that referenced this issue Feb 14, 2016
Added enable/disable Parse curl exceptions
@tranhiepvn
Copy link

How can I have the parse-server-example package that fixed this?

@SeunMatt
Copy link

SeunMatt commented Sep 1, 2016

Hello, I am having the same issue ParseRequestException invlaid key name. Read through this issue and the other issue #105 yet couldn't fix the issue. Am using android sdk version 1.13.1 Please can you help?

bernhardharrer pushed a commit to bernhardharrer/parse-server that referenced this issue Feb 22, 2017
Added android equivalent code of Parse.initialize()
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

7 participants