[INTERNAL_SERVER_ERROR] Cannot read properties of undefined (reading 'primary') [Solved]
Have you recently updated Directus and when you logged in received this message? You have come to the right place.
To resolve this error, you need to run the latest migrations for the database. SSH to your Directus project folder and run npx directus database migrate:latest
, then restart Directus.
The full error message appears like the JSON below and basically means it is trying to get data from source that doesn't exist. In this case, the upgrade to Directus required some migrations in the database that hasn't been performed.
{
"errors": [
{
"message": "Cannot read properties of undefined (reading 'primary')",
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
]
}
To resolve this issue, you need access to the Directus project folder using Terminal or Command Prompt. Run the following command:
npx directus database migrate:latest
The changes are listed after each step has completed. For example:
INFO: Running migrations...
INFO: Applying Update Material Icons...
INFO: Applying Add Preview Settings...
INFO: Applying Migrate Translation Strings...
INFO: Database up to date
Note the last line tells us the process has complete.
Finally restart Directus to adopt the changes.
For a full guide on how to update Directus, be sure to bookmark the link below: