Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
930 stars 194 forks source link

[Bug]: Inconsistent Behavior during Hot Reload for changes in Runtime Section of the config. #2392

Closed abhishekkumams closed 6 days ago

abhishekkumams commented 1 month ago

What happened?

Summary:

When using the Hot Reload feature to update the Runtime section of the configuration, the system does not properly refresh all objects. This leads to inconsistent behavior, specifically resulting in "resource not found" errors after re-enabling REST/GraphQL endpoints.

Steps to Reproduce:

  1. Start the engine and verify that both REST and GraphQL endpoints are accessible.
  2. Update the configuration to disable REST/GraphQL in the Runtime section.
  3. Observe that the engine reloads and both REST and GraphQL endpoints become inaccessible as expected.
  4. Update the configuration again to re-enable REST/GraphQL.
  5. Attempt to query the REST and GraphQL endpoints.

Observed Behavior:

After re-enabling REST/GraphQL, the endpoints are accessible, but querying them results in "resource not found" errors.

Expected Behavior:

After re-enabling REST/GraphQL, the endpoints should be fully functional and return the expected resources without errors.

Thoughts:

The issue appears to be related to the incomplete refresh of internal objects during the Hot Reload process. When the configuration is updated to re-enable REST/GraphQL, some objects or states are not properly re-initialized, leading to the "resource not found" errors.

Possible Root Causes:

Incomplete State Reset: Certain internal states or objects are not fully reset or re-initialized during the Hot Reload process. Dependency Injection: Services or dependencies related to REST/GraphQL might not be properly re-injected or re-configured.

Attachments:

  1. REST response (after re-enabling) image

  2. GraphQL response (after re-enabling) image

Version

main

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

No response

Code of Conduct

seantleonard commented 1 month ago

isn't this due to pending completion of #2324?

abhishekkumams commented 1 month ago

isn't this due to pending completion of #2324?

It shouldn't be because in this case we are not adding or removing any entities. We are just enabling/disabling global endpoints.