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
GraphQL error: Cannot set properties of undefined (setting 'code') #17817
Comments
Would you be able to provide an exact reproduction? |
I can’t as the data is sensitive. I can do a private screenshare though if that would help. |
If possible, simply some steps like the following example would be enough:
|
I think it might be specific to MS SQL. Anything from the graphql side that triggers an error (could be any error) that hits the formatError function causes the problem. File: /api/src/services/graphql/index.ts |
It seems as though the "extensions" property on the error is set on the BaseException class:
However, when it's trying to extract the error and it can't find the error code it just straight up returns the error object: Whereas it should be wrapping it in a new exception that extends the BaseException. |
These are currently the error codes for MSSQL for the Directus dialects:
The error I hit had a code of 544. So we can either:
|
Checklist
Describe the Bug
There is an issue with the GraphQL service that when there's an error, and Directus tries to format that error, it fails because a property on the error doesn't exist. It's trying to set "code" on the "extensions" property of the error but "extensions" doesn't exist which gives the error below.
To Reproduce
I'm using SQL Server, try making a graphql request that errors out.
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered: