lipusal lipusal - 1 year ago 252
PHP Question

Can't perform batch operations after migration

I've recently completed migrating my Parse PHP application to a Google Cloud-hosted Parse Server. Since then, batch actions like

, etc. started to fail on most cases. I'm thinking about reporting this as a bug on GitHub but I want to ensure it's not just my instance.

I can't even reproduce the GitHub PHP SDK test code for destroyAll:

$o1 = ParseObject::create('TestObject');
$o2 = ParseObject::create('TestObject');
$o3 = ParseObject::create('TestObject');
ParseObject::saveAll([$o1, $o2, $o3]);
ParseObject::destroyAll([$o1, $o2, $o3]);

Both this code and my application's uses of batch actions throw the following kind of exception on PHP (in this example, the error is thrown by saveAll):

Uncaught exception 'Parse\ParseException' with message 'cannot route batch path /1/classes/TestObject'

Debugging shows that Parse Server returns error code 107 which according to the documentation means Invalid JSON. I'm not familiar with the REST API, but for this example, the data sent is


Which is valid JSON.

Batch actions worked properly before migrating. PHP version is 5.6. Any help is appreciated. If the error can be reproduced, I will create an issue on GitHub.

Answer Source

The solution was to write /parse/classes/ClassName instead of /1/classes/ClassName. So after migration, the details stated in the documentation at, are outdated.

!!! this might change in the future !!! keep an eye on this issue:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download