Here is my setup:
CouchDB: 2.3.1
LoopBack: 1.11.2
NPM: 6.9.0
Using LoopBack API Explorer, here is the rest call made:
curl -X PUT "http://localhost:3000/skilltypes/0" -H "accept: */*" -H "Content-Type: application/json" -d "{json_here}"
http://localhost:3000/skilltypes/0
204 SkillType PUT success
In Fauxton, I see the record in the database.
However, the NodeJS server crashes with the following error:
assert.js:350
throw err;
^
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
assert(doc._id)
at CouchDB.fromDB (/home/dan/projects/SkillType/my-app/node_modules/loopback-connector-couchdb2/lib/couchdb.js:163:3)
at /home/dan/projects/SkillType/my-app/node_modules/loopback-connector-couchdb2/lib/couchdb.js:701:21
at Request._callback (/home/dan/projects/SkillType/my-app/node_modules/nano/lib/nano.js:221:16)
at Request.self.callback (/home/dan/projects/SkillType/my-app/node_modules/request/request.js:185:22)
at Request.emit (events.js:189:13)
at Request.<anonymous> (/home/dan/projects/SkillType/my-app/node_modules/request/request.js:1161:10)
at Request.emit (events.js:189:13)
at IncomingMessage.<anonymous> (/home/dan/projects/SkillType/my-app/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:277:13)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1125:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dan/.npm/_logs/2019-04-26T13_07_37_106Z-debug.log
Edit:
My model is the following. I will post a payload ASAP.
import {Entity, model, property} from '@loopback/repository';
@model({settings: {"strict":false}})
export class SkillType extends Entity {
// Define well-known properties here
@property({
type: 'number',
id: true,
})
id: number;
// Indexer property to allow additional data
[prop: string]: any;
constructor(data?: Partial<SkillType>) {
super(data);
}
}
This looks like a bug in LoopBack's connector for CouchDB to me. Can you report the issue on GitHub please?
Please follow project's bug reporting guidelines.