Hey, I really need this module to work, And it works just like I need...
But often I get an error when creating a node....
Drupal just says "The website encountered an error", but in the log I can see this
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '283' for key 'PRIMARY': INSERT INTO {node_authlink_nodes} (nid, authkey, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 283 [:db_insert_placeholder_1] => 22f67232f3be0c6204e786c42efb59f1b9c05afc0501054fb2ce2791da80bc82 [:db_insert_placeholder_2] => 1394142904 ) in node_authlink_node_insert() (line 242 of C:\Apache2.2\htdocs\abcbookingV3\sites\all\modules\node_authlink\node_authlink.module)
So somehow it tried to duplicate an id key? how can we fix this?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | node_authlink_2212479.patch | 1.2 KB | alexh |
Comments
Comment #1
joelpittetThis is old with 2 followers, I'll close this in hopes you've worked through the issue. If not or someone else runs upon this, try checking if
hook_node_insertgets called more than twice, and if please provide steps to reproduce the issue if possible.Sounds a bit like a race condition, that we might be able to sort out but really need to know what conditions are causing before throwing fixes at it.
Comment #2
alexh commentedSorry to post in a closed issue. But I had the same issue and solved it, so I just want to share this with anybody who still would need it.
The error occurred in my setup when using also the Media Bulk Upload module. I see that in that module entity_save is called three times, so I assume this is causing the multiple calls of hook_node_insert. Bulk Media Upload is unmaintained and I did not see how to fix the issue there.
But I saw two issues in the hook_node_insert implementation of this module:
Attached is a patch which addresses both issues and fixed the issue for me.
Comment #3
joelpittetThanks for getting back can you attach the patch you planned?
Comment #4
alexh commentedSorry for forgetting to provide the patch file and for not noticing this for a long while...eventually, the patch is attached here.
Comment #5
tunicI'm sorry but Drupal 7 is no longer supported so I'm closing this. Please feel free to reopen it if it applies to any of the supported releases.