I'm attempting to delpoy a node and I it fails with this error message in the log:
Service error: 406 Not Acceptable: Term object needs vid property.
I debugged the problem and the error is thrown from services/resources/taxonomy_resource.inc. Here is the relevant function:
function _taxonomy_resource_update_access($tid, $term) {
// Adds backwards compatability with regression fixed in #1083242
$term = _services_arg_value($term, 'term');
$term = (object) $term;
if (!isset($term->vid)) {
error_log(var_export($term,1));
return services_error(t('Term object needs vid property.'), 406);
}
return user_access('edit terms in ' . $term->vid) || user_access('administer taxonomy');
}
Deployment module uses entity_uuid_load() which calls this function in uuid/uuid.core.inc
function taxonomy_entity_uuid_load(&$entities, $entity_type) {
if ($entity_type == 'taxonomy_term') {
foreach ($entities as &$entity) {
if (isset($entity->parent)) {
if (!is_array($entity->parent)) {
$entity->parent = array($entity->parent);
}
$uuids = entity_get_uuid_by_id('taxonomy_term', $entity->parent);
$entity->parent = array_values($uuids);
}
unset($entity->vid);
}
}
}
Notice that the vid is unset!
So at this point I'm not sure which module is to blame, uuid, deploy, or services. My gut feeling is that services shouldn't rely on the vid, but use the vocabulary machine name instead. There's #995156: Use vocabulary machine name for permissions that may be related?
FYI, I am using the latest dev versions:
deploy-7.x-2.x-dev
services-7.x-3.x-dev
entity_dependency-7.x-1.x-dev
uuid-7.x-1.x-dev
Comments
Comment #1
ttkaminski commentedAs a followup, when deploying a node to the REST service, the logs show that it first authenticates, then tries to PUT the taxonomy_term. Shouldn't deploy try to PUT the taxonomy_vocabulary first? How does it know if the vocabulary exist at the remote endpoints?
Comment #2
dixon_This might be related to #1520410: Deployment halts with "Term Object Needs vid property."