Better debugging
Is your feature request related to a problem? Please describe. I'm getting an error during a schema push, and I want more information regarding the error, but when I use the debug option all I get is this:
[09:31:42.351] DEBUG (1482): [migration-client] Cache cleared
[09:31:42.363] INFO (1482): ---- Push schema ----
[09:31:43.005] ERROR (1482):
errors: [
{
"message": "Cannot read properties of undefined (reading 'fields')",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"stack": "TypeError: Cannot read properties of undefined (reading 'fields')\n at FieldsService.createField (file:///app/directus/node_modules/@directus/api/dist/services/fields.js:262:79)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async file:///app/directus/node_modules/@directus/api/dist/utils/apply-diff.js:158:21"
}
}
]
response: {}
Describe the solution you'd like I would like it to tell me which file triggered that error so it is easier for me to debug it and find the problem.
I was facing a similar issue. I was running some custom migrations for pgvector columns before pushing the directus-sync schema. Once I got rid of those and did them after directus-sync push, the issue went away.
In my case, I suspect that it was due to directus not recognizing pgvector columns.
Your database may include one or more collections with columns that are incompatible with the Directus version you're trying to push the schema to.
Resolution:
- Ensure that all required collections and their columns exist and are compatible with the targeted Directus version.