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
[Bug]: Validating entity relationships throws unhandled exception #2184
Comments
Does |
I get a different stack trace:
|
this was not caught presumably because it doesn't occur on |
The above comment holds true when the @Aniruddh25 , can you confirm whether your config had a valid connection string or if you were using an environment variable placeholder for your connection string? Agreed that the error message isn't helpful so one path forward here is:
|
I found the same in my investiation. This only arises when the connection string is invalid. My thought was to add a try catch to the validation steps that rely on the connection string and then some messaging to help explain the problem. |
… correctly initialized (#2202) ## Why make this change? Closes #2184 Closes #2180 ## What is this change? When we don't properly initialize the `SqlMetadataProvider`, certain functions will not behave as intended. This change adds some defensive programming around this fact so that we have more readable exceptions in these cases, as well as restructuring the validation to avoid the potential of such a circumstance. We refactor the `ValidateEntitiesMetadata` function into 2 functions, one called `ValidateRelationshipConfigCorrectness` that validates the relationships in the config without needing to cross reference database metadata, and leaving the remaining validations that do require such metadata within the original function. This validation is then handled by a mix of the initialization of the metadata provider (this init process does some validation), and the call to `ValidateRelationships` which happens from within `ValidateEntitiesMetadata` only when the initialization of the metadata provider resulted in no connection errors. Therefore, the normal code path when doing `dab validate` will be 1. Call `ValidateRelationshipConfigCorrectness` 2. Call `ValidateEntitiesMetadata` 2a. If there were no connection errors Call `ValidateRelationships` ![image](https://github.com/Azure/data-api-builder/assets/93220300/1e2feec5-ac73-4e57-b3eb-01f032f362cf) ## How was this tested? Manually, against our test suite, and we add a regression test that looks for the correct error messaging when the config that caused the error from the finding of the bug is used. ## Sample Request(s) This can be reprod by using the command `dab validate -c <path to config>
What happened?
Cannot figure out what's wrong with this sample config. Doing
dab validate
causes anUnhandled Exception
with the stack trace as provided in the log output.Version
0.12.0-rc
What database are you using?
Azure SQL
What hosting model are you using?
Local (including CLI)
Which API approach are you accessing DAB through?
No response
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: