Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App error - Collection model roles has no primary key attribute #4037

Open
jamesgid-gc opened this issue Apr 15, 2024 · 1 comment
Open

App error - Collection model roles has no primary key attribute #4037

jamesgid-gc opened this issue Apr 15, 2024 · 1 comment

Comments

@jamesgid-gc
Copy link

Describe the bug

Hi team. I am very new to Nocobase, so my apologies if I have missed something basic. Using Portainer, I created a nocobase container and was able to use it. However, it was completely default with no env variables, so nothing was persistent. I have since created a contaner for MariaDB and then declared env variables for nocobase. However, upon starting the container I see 'App error - Collection model roles has no primary key attribute' error in the web interface.
The data base connection is working because tables have been created. Not sure what else I have missed.
The log file also has these entries:
copying... yarn run v1.22.19 $ nocobase create-nginx-conf Done in 0.28s. nginx started yarn run v1.22.19 $ nocobase start --quickstart 2024-04-15T03:13:55: PM2 log: Launching in no daemon mode 2024-04-15T03:13:55: PM2 log: App [index:0] starting in -fork mode- 2024-04-15T03:13:55: PM2 log: App [index:0] online Gateway IPC Server running at /app/nocobase/storage/gateway.sock Gateway HTTP Server running at http://0.0.0.0:13000/ INF add app main into supervisor | meta={} module=application submodule=supervisor method=addApp app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:57 INF connection has been established successfully. | meta={} module=database submodule= method=auth app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:57 INF upgrading... | meta={} module=application submodule= method= app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:57 INF run upgrade | meta={} module=application submodule= method= app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:57 INF update built-in plugins | meta={} module=nocobase submodule= method= app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:57 new client connected ravcxOTIfoOjJZiv-e9xs client tags: app#main INF run upgrade | meta={} module=application submodule= method= app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:59 INF restarting... | meta={} module=application submodule= method= app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:59 INF app.reload() | meta={} module=application submodule= method=load app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:59 ERR Collection model roles has no primary key attribute | stack=Error: Collection model roles has no primary key attribute at _BelongsToManyField.bind (/app/nocobase/node_modules/@nocobase/database/lib/fields/belongs-to-many-field.js:107:13) at _Collection.<anonymous> (/app/nocobase/node_modules/@nocobase/database/lib/collection.js:621:13) at _Collection.emit (node:events:517:28) at _Collection.emit (node:domain:489:12) at _Collection.setField (/app/nocobase/node_modules/@nocobase/database/lib/collection.js:267:10) at EnsureAtomicity.descriptor.value (/app/nocobase/node_modules/@nocobase/database/lib/collection.js:58:29) at /app/nocobase/node_modules/@nocobase/plugin-collection-manager/dist/server/models/field.js:45:25 at async model.load (/app/nocobase/node_modules/@nocobase/plugin-collection-manager/dist/server/models/field.js:43:19) at async model.loadFields (/app/nocobase/node_modules/@nocobase/plugin-collection-manager/dist/server/models/collection.js:110:7) at async CollectionRepository.load (/app/nocobase/node_modules/@nocobase/plugin-collection-manager/dist/server/repositories/collection-repository.js:119:7) meta={} module=application submodule= method= app=main reqId=de4e2b6e-0a20-449d-a1e0-bb495b728856 timestamp=2024-04-15 03:13:59 client disconnected ravcxOTIfoOjJZiv-e9xs WRN app is not running | meta={"status":"error"} module=gateway submodule= method=requestHandler app=main reqId=020b4b01-49e2-4af4-b680-05a0029d0b67 timestamp=2024-04-15 03:30:09 ERR Collection model roles has no primary key attribute | meta={"error":{"status":503,"message":"Collection model roles has no primary key attribute","code":"APP_ERROR","command":{"name":"start"},"maintaining":true}} module=gateway submodule= method=responseErrorWithCode app=main reqId=c358ad69-19b5-46cd-98eb-929da790364b timestamp=2024-04-15 03:30:09 new client connected ZswavY0BVM1OXWDFHLj_D client tags: app#main

Version

18.20.2

How To Reproduce

As above, launch new container, error presents upon start.

@Decapitares
Copy link

I have the same problem with mysql, it created the tables and the primary key is as it should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants