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.

404 on list action for model/view without primary key

See original GitHub issue

Describe the bug

404 status on /admin/api/resources/:name/actions/list

Installed libraries and their versions

    "@admin-bro/koa": "^1.1.1",
    "@admin-bro/sequelize": "^1.1.1",
    "admin-bro": "^3.3.1",
    "pg": "^8.5.1",
    "sequelize": "^6.3.5"

To Reproduce

Steps to reproduce the behavior:

  1. Create view without primary key id
  2. Request /admin/api/resources/:name/actions/list
  3. See logs: SELECT "id", ...
  4. See error

Expected behavior

  1. 200 HTTP
  2. Correct query without not defined field

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
earthpyycommented, Jan 12, 2022

Primary key is required because whole admin-bro depends on it for finding records and filtering, i. e. bulk delete. Composite keys won’t work here. I personally just add an auto-generated PK for i. e. junction tables

@dziraf Do you have any other solution than adding an AI field over multiple-columns primary key?

0reactions
haplocommented, Oct 7, 2022

how do you expect in-app routing to work with composite keys? currently recordId is a single identifier

I’m not intimate with AdminJS internals, but could recordId be a list with the primary key columns?

Read more comments on GitHub >

github_iconTop Results From Across the Web

404 on list action for model/view without primary key #708
I'm getting 404 on the list route for my user resource. It has a primary key in the DB and in the sequelize...
Read more >
Getting 404 Error MVC when trying to add New Object to a List
The problem is that there is no action for your AddNewFriend View to redirect, a view should have a action with method get...
Read more >
Handling 404 Not Found in Asp.Net Core - DevTrends
Handling specific cases of page not found is best addressed with a custom view and setting the status code (either directly or via...
Read more >
How to handle 404 errors in ASP.NET Core MVC - InfoWorld
NET Core as the runtime and ASP.NET Core 3.1 (or later) from the drop-down list at the top. Select “Web Application (Model-View-Controller)” as ......
Read more >
Viewsets - Django REST framework
Django REST framework allows you to combine the logic for a set of related views in a single class, called a ViewSet ....
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