-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Using Update Function throws occasional 412 errors when documents has inline attachments #584
Comments
Hi @ArikShifer Are you able to test this against CouchDB master at all? We're finalising the list of bugs for fixing in 2.1 and need a reproducible test case for this against master if we're to consider this a blocker. |
HI @wohali, unfortunately I cannot test against CouchDB master. My project is restricted to couchdb v2.0.0. |
Hi Same issue here (also with 2.0.0). Regards, |
@moreiramarti We need a reproducible test case. |
Closing for inactivity. Please reopen with a reproducible test case. |
I'm using javascript Update Functions to invoke server-side logic to update some individual fields in documents without first getting the latest revision as explained in: http:https://docs.couchdb.org/en/2.0.0/couchapp/ddocs.html?highlight=update%20handler.
My documents have inline attachments. The individual fields I'm updating are not the document _attachments. On occasions I'm getting 412 'Precondition Failed' error with message 'Invalid attachment stub in <doc_id> for <attachment_name>'.
The error seems false positive because when I inspect the document I see that it has the updated content and the _attachments part looks intact (see example).
"_attachments": {
"content": {
"content_type": "text/plain",
"revpos": 1,
"digest": "md5-H05fzZIvzFkyezESkSEwwQ==",
"length": 32,
"stub": true
}
}
Expected Behavior
Update function should consistetly return success code.
Current Behavior
Update function return success code on about 50% of executions.
The other times it throws 412 'Precondition Failed' error with message 'Invalid attachment stub in <doc_id> for <attachment_name>'. But the document is updated correctlly when inspected at the DB.
Possible Solution
?
Steps to Reproduce (for bugs)
Use couchdb v2.0.0 and nano js client to:
Your Environment
The text was updated successfully, but these errors were encountered: