I'm running the latest dev versions of services, deploy, uuid and entity_dependency and am able to transfer the title/body of a node just fine between two servers.
When I try to add an image to the mixture I start getting failures. I've applied the #15 and #24 from: http://drupal.org/node/1324970 as seen to address this same issue but to no avail.
I'm getting an invalid UUID on the file entity:
UuidEntityException: Trying to save a File entity with empty or invalid UUID. in entity_make_entity_local() (line 239 of /opt/lampp_php52/htdocs/staging/jg_jamaicagleaner/drupal/sites/all/modules/contrib/uuid/uuid.entity.inc).
And then getting the same FID was truncated error that issue #1324970 addressed even with patches applied:
PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 619db878-a76f-f0e4-0d67-0d4925543fc4 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 654 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 664 of /opt/lampp_php52/htdocs/staging/jg_jamaicagleaner/drupal/includes/file.inc).
Has anyone else run into this same issue?
For troubleshooting I've also tried recreating any UUID values that aren't created from the GUI.
When I deploy the node all comes back as a positive deployment but checking the debug on destination server I find the errors above.
In addition after each of the errors above I get the following PHP warning:
Warning: Header may not contain more than a single header, new line detected. in drupal_send_headers()
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | uuid-fix-uuid-save-1694972-30.patch | 758 bytes | sylus |
| #27 | uuid-fix-uuid-save-1694972-22.patch | 1.29 KB | carlhinton |
| #25 | uuid-invalid_uuid-1694972-22.patch | 851 bytes | carlhinton |
| #24 | uuid-invalid_uuid-1694972-22.patch | 899 bytes | carlhinton |
| #23 | uuid-fix-make-local-1469716-14.patch | 555 bytes | carlhinton |
Comments
Comment #1
skalfyfan commentedGetting this example same error.
Anyone have any idea?
Comment #2
skalfyfan commentedDug deeper and I have attached screenshots. This only happens when trying to push a piece of content with a file field attached to it. Regular nodes with just title, body push and deploy 100% fine.
For some strange reason though when I push a piece of content with a file attached we get access denied in our json.
Screen 1:
This is a shot of Recent Logs on destination server after attempted a content push that has a file attached. You can see where the UUIDEntityException occurs as described above by kbasarab. We can see that a session is successfully opened for my admin user (super user account.)
If I go click on Calling server: rest_server_server we go to Screen 2.
Screen 2:
Click on location to examine the json we see the following on Screen 3.
Screen 3:
Access denied for user admin ?!
If I open any of the above calls in Screen 1 - E.g Passed Arguments: Array and click on the LOCATION to view the json it still says Access Denied. So this makes sense that it is posting the UUIDEntityException because it is being passed a json object which only contains ["Access denied for user admin"] and it is not finding the entity UUID.
What could be causing this? If I don't change any settings but push a piece of content with just title, body everything works flawlessly!
Thanks in advance!
Comment #3
skalfyfan commentedMore Updates:
It appears this is an issue with the current Services module. I am using the latest dev version of Services (2012 July 17th.)
If I go to the Services module folder and open the file services.runtime.inc and comment out the following lines (#144-148):
then everything works flawlessly again and I see the image gets deployed from staging to production!
I took a look at what the $controller['access callback'] value is when trying to deploy a content type that includes file and it is calling _uuid_services_entity_access. This as far as I've gotten. Still investigating...
Comment #4
skalfyfan commentedSo I guess it's related to UUID module now? and perhaps directly related to this issue:
http://drupal.org/node/1469716
Appears that it is not resolved since the Services check is failing and returning false ?
Comment #5
kbasarab commentedI've tried to replicate what you found skal on this and commented out that code but hit a different issue. I was greeted with a rules error for a "RulesEvaluationException: Argument previous state is missing"
This ties back to this function:
http://api.drupalize.me/api/drupal/function/RulesPlugin%3A%3AgetArgument/7
I disabled Rules and was able to replicate what you've found so far. Removing the code allowed the image to go through.
Not sure why the rules piece is happening too. Might be something to do with how the node is submitted but if I remember right deploy is actually submitting via a node submit form and not injecting the node object directly.
Comment #6
skalfyfan commentedI can't comment on the Rules issue as I'm not using the rules module yet, but scary to know there's more problems incoming there! :)
I've gotten around the problem by using a hack solution I described in #4 above: http://drupal.org/node/1469716
Basically inside /modules/uuid/uuid_services/uuid_services.module find the following function / code block:
...and directly below the above I have added:
This is identical to the hack described in the issue posted at http://drupal.org/node/1469716 and it fixes the problem by forcing true return. It's horrible as a solution and I'll want to put together a proper patch as soon as I isolate the actual cause of the issue.
I'm still looking but have isolated it to this code block within the same _uuid_services_entity_access($op, $args) function above.
Basically the below code is within a try / catch code block and it is failing and throwing an exception, thereby forcing the errors. It is never reaching the bottom of the try block to return a value (...so far only seems to occur with file entities)
Comment #7
jpoesen commentedApplying skal's fix (described in #6) on the endpoint works for me.
Thanks, skal.
Comment #8
kbasarab commentedJust a followup to this. Rules is working now for me as well. Not sure what the issue was there. I had simply made the suggestion in #3 and all is still working great for me.
Comment #9
flyingkiki commentedCreate patch described in #6
Comment #10
rob_johnston commentedHad the exact same log entries and the patch worked.
Comment #11
tdway commentedThe patch worked for me as well
Comment #12
sarjeet.singh commentedI got below error after apply #9 patch
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'cecbfceb-81f0-74a4-a5b2-4953758432f5' for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => cecbfceb-81f0-74a4-a5b2-4953758432f5 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 1594 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (Zeile 664 von //includes/file.inc).
Comment #13
louis_sabet commentedThis issue still seems to exist.
Reading the post here: http://drupal.org/node/1469716, suggests that the patch suggested in 6 opens up a security hole - unless I've misread/misunderstood.
Has anyone managed to get around this without hacking? Seems like a massive issue since deploying images isn't exactly an unlikely use case.
Happy to put some testing into this if someone has some time to think about how to resolve the issue.
Comment #14
admtkc commentedWell, we met this error and this problem come from UUID conflict, so if in your source server generated UUID already, then you should not generate UUID again on destination server.
So this is my solution for this :
Source server : we generate UUID once time. Then get db dump, after that we create destination server with this DB dump.
So UUID will be sync between source server and destination server and you shouldn't get this error again.
Cheers
Comment #15
ohthehugemanatee commentedRelated issue: #1820822: deploying content type with a filefield returns 404 Not found: Could not find the controller. . I'm also getting 404 controller not found, but details in the logs are different... it's a different issue, but might be related.
Comment #16
kenorb commented#1324970: Image fields don't work Patch at #24
#1390708: Fix crash with reference to missing entity
Comment #17
cracu commentedAccess callback assigned for any entity is _uuid_services_entity_access which is calling a specific function for each type of entity:
for files the callback is entity_metadata_file_access() function which gets $op parameter with value 'update'.
After a quick view over function code it seems that it will always return FALSE.
A quick fix without altering the contrib modules would be to implement hook_services_resources_alter() in a custom module
and set:
and make that callback return TRUE or implement a better function.
after that you should re-save the endpoint on target server.
Comment #18
dillix commentedThere is a bug in:
Should be:
And after that no patch needed!!!
Comment #19
cloudbull commentedDo you mean #6 not needed as well ?
Keith
Comment #20
darrenmothersele commentedI'm pretty sure #18 is a bug, but it's not the cause of the issue fixed by #6.
You either need the fix in #6, or do what is suggested in #17.
Neither of which get to the root of the issue. Would it perhaps be up to file entity to implement the access callback suggested in #17?
Comment #21
admataz commentedThis is related: #1778484: UUID Services for file should not use the update method.
There seems to be an issue with the PUT http method used by deploy, and file entities and UUID.
Comment #22
carlhinton commentedBy editing uuid.entity.inc with the following I was able to prevent this error
The code amounts to an early bail on saving an entity where it has no UUID or an invalid UUID.
Such problems are mostly caused by services or caching issues.
Comment #23
carlhinton commentedPatch for #22
Comment #24
carlhinton commentedPatch for #22
Comment #25
carlhinton commentedThird time lucky
Comment #26
carlhinton commentedComment #27
carlhinton commentedThe attached patch combines that found at http://drupal.org/node/1469716 with #25 above
Comment #28
attiks commented#27 works, but is against the uuid project, maybe move it?
Comment #29
kenorb commentedComment #30
sylus commentedUpdating patch to latest dev and also looks like 1469716 was committed already.
Comment #31
a_khalipau commentedThis bug appears because default file entity doesn't have 'creation callback' which needs for entity_create() function.
Installation of File Entity module (https://drupal.org/project/file_entity) solves this problem.
Comment #32
lisa.rae commentedxopoc: does the installation of the file_entity module solve this problem with or without the patches in this thread?
In either case, the .info file needs to reflect the dependency on file_entity.
Comment #33
dixon_Committed. Thanks!