apache / apache/openwhisk-package-cloudant
Write with Overwrite = true fails if doc doesn't exist
- Dominant language
- Scala
- Stars
- 17
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
If you do a write with `--param overwrite 'true' ` on a non-existent doc id:
```
wsk action invoke cloudant/write --blocking --result --param overwrite 'true' --param doc '{"foo": "bar", "_id": "nonexistent_docid"}'
```
it gives an error:
```
"stack": "Error: missing\n at Request._callback (/nodejsAction/node_modules/cloudant-nano/lib/nano.js:247:15)\n at Request.self.callback (/nodejsAction/node_modules/request/request.js:186:22)\n at emitTwo (events.js:106:13)\n at Request.emit (events.js:191:7)\n at Request. (/nodejsAction/node_modules/request/request.js:1081:10)\n at emitOne (events.js:96:13)\n at Request.emit (events.js:188:7)\n at IncomingMessage. (/nodejsAction/node_modules/request/request.js:1001:12)\n at IncomingMessage.g (events.js:291:16)",
"statusCode": 404
```
But if I remove the `--param overwrite 'true'`, it works. And then subsequent writes with `--param overwrite 'true'` succeed and update the revision.
In this case, I think it's safe to ignore the 404 error trying to do the `GET` to fetch the existing revision, since it's expected that it might be the first revision, and no existing revisions exist.
Contributor guide
Assessment
This issue has not been assessed yet.