question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while making a PATCH method call

See original GitHub issue

I was looking to send atomic updates to my server and in doing so required a PATCH call to be made. But the server returned the following error to the client (with errorhandler on).

{
  "name": "GeneralError",
  "message": "column \"id\" does not exist",
  "code": 500,
  "className": "general-error",
  "data": {},
  "errors": {}
}

Without errorhandler this was the error printed on the server console.

SequelizeBaseError: column "id" does not exist                                                                                     
    at Query.formatError (D:\code\playground\core-playground\feathers\node_modules\sequelize\lib\dialects\postgres\query.js:357:14)
    at Query.<anonymous> (D:\code\playground\core-playground\feathers\node_modules\sequelize\lib\dialects\postgres\query.js:88:19) 

Now I was able to make GET PUT calls to the server no problem. But it’s only during PATCH is when I’m facing this issue. And I am a bit confused sue to that reason, because PUT must take similar arguments as PATCH.

Any way to diagnose it further?

One possibility is that my primary key in the resource is not named id rather custom named as xyz_id, if this is the issue in fact then any way I can use a hook to pre-process the data and make the patch method work? And also shouldn’t this simply work out of the box given the id is already present in the URL to which the call is made /db/:resource/:id and there should be no reliance on the primary key being named id.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dafflcommented, Feb 6, 2017

I still think using the primary key of the model as the id property by default is a valuable change. So let’s keep this open.

1reaction
dafflcommented, Feb 5, 2017

I think the reason is that get, update and remove use findById where patch does not. We’ll need a way to get the name of the primary key field from the model and then use that for patch as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error while using PATCH method in HttpURLConnection
I've successful build GET and POST request using HttpUrlConnection . But in PUT method plsguide me in codes whether I am doing any...
Read more >
PATCH - HTTP - MDN Web Docs
The HTTP PATCH request method applies partial modifications to a resource. PATCH is somewhat analogous to the "update" concept found in CRUD ...
Read more >
Error occuring when executing PATCH call for API Update ...
This issue is caused by a wrong Parameter If-Match being maintained. Error Runtime Error: 'ASSERTION_FAILED' : means that the parameter is not ...
Read more >
PATCH method on exposed REST services
PATCH method allows a new HTTP method when exposing REST APIs that applies partial modifications to a resource.
Read more >
RFC 5789 - PATCH Method for HTTP
The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found