feathersjs-ecosystem / feathers-cassandra

Feathers service adapter for Cassandra DB based on Express-Cassandra ORM and CassanKnex query builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

patch fails with BadRequest syntax error

apmcodes opened this issue · comments

patch fails with the below error

error: BadRequest: line 1:49  : syntax error...

    at new BadRequest (/xxx/api/node_modules/@feathersjs/errors/lib/index.js:86:17)
    at errorHandler (/xxx/api/node_modules/feathers-cassandra/lib/error-handler.js:39:25)
    at process._tickCallback (internal/process/next_tick.js:68:7)

On checking, the _patch(id, data, params) function seems to receive id as null instead of the primary key (same issue even with composite primary key)

data { id: 3, text: 'howdy' }
id null

If I manually set context.id with the id in a before hook then patch works. Should we add id manually in a hook or should feathers-cassandra adapter generate id from context.data, please clarify

I'm not sure how are you using the patch method, but according to your example here, you'll need to run: patch(3, { text: 'howdy' }). this works with the current example app.

Hmm,

I'm using postman to place a patch call with data as x-www-form-urlencoded.
id: 1
text: howdy

In feathers-cassandra console log
patch data { id: 1, text: 'howdy' }
id null

If i need to call patch from a hook or another service then I can call using patch(3, { text: 'howdy' })

Duh ... I need to read better before posting issues ... Thank you for taking the time to clarify.