[Bug]: Table writes fail (HTTP 500) for entities defined in a linked `data-source-files` config
Maintainer thường phản hồi trong vòng 8 ngày
@souvikghosh04 đang làm issue này rồi.
Từ ngày 7/7/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
When
Using a multi-database setup where a root config links a second database config via data-source-files:
# Root config (database 1)
dab init --database-type mssql --connection-string "@env('DAB_SQL_DB1')" --host-mode Development -c dab-config.json
dab add Db1Orders --source dbo.Orders --permissions "anonymous:*" --source.type table -c dab-config.json
# Linked config (database 2)
dab init --database-type mssql --connection-string "@env('DAB_SQL_DB2')" --host-mode Development -c dab-config-db2.json
dab add Db2Customers --source dbo.Customers --permissions "anonymous:*" --source.type table -c dab-config-db2.json
# Link them
dab configure --data-source-files dab-config-db2.json -c dab-config.json
dab start -c dab-config.json
Then send a write to a table entity that is defined in the linked file (dab-config-db2.json):
POST /api/Db2Customers
Content-Type: application/json
{ "Name": "test" }
Expected
The insert succeeds and returns HTTP 201 with the created row, the same as an equivalent table entity defined in the root config. Table writes should work regardless of whether the entity's data source is in the root config or in a linked data-source-files config.
Actual
The request returns HTTP 500 with a generic error:
{
"error": {
"code": "UnexpectedError",
"message": "While processing your request the server ran into an unexpected error.",
"status": 500
}
}
The server log shows a KeyNotFoundException keyed by the entity name, thrown in the SQL mutation/insert path:
System.Collections.Generic.KeyNotFoundException: The given key 'Db2Customers' was not present in the dictionary.
at Azure.DataApiBuilder.Core.Resolvers.BaseQueryStructure..ctor(...)
at Azure.DataApiBuilder.Core.Resolvers.SqlInsertStructure..ctor(...)
at Azure.DataApiBuilder.Core.Resolvers.SqlMutationEngine.PerformMutationOperation(...)
Scope / Root cause (confirmed by test)
The failure is positional, not database- or table-specific. Swapping the topology proves it — the same table behaves differently based only on which config file it lives in:
| Table | In root config | In linked data-source-files config |
|---|---|---|
dbo.Categories |
POST succeeds (200/201) | POST fails (500) |
dbo.Category |
POST succeeds (200/201) | POST fails (500) |
Additional observations:
- Reads (
GET) work for linked-file entities. - Stored procedures in linked files work (they use the
executepath, not the table-mutation path). - Only table mutations (
POST/PUT/PATCH/DELETE) on linked-file entities fail. dab validatepasses and reports REST paths for all entities across both files.
Impact
In a multi-database DAB instance, tables in any linked (non-root) database are effectively read-only. Only the root database supports table writes.
- Ngôn ngữ chính
- C#
- Star
- 1.5k
- Fork
- 371
- Merge trung bình
- 8 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/data-api-builder
-
pgsql
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3598 ·
Maintainer thường phản hồi trong vòng 8 ngày
-
2.x cli mcp-server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3576 ·
Maintainer thường phản hồi trong vòng 8 ngày
-
2.x health-endpoint
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3570 ·
Maintainer thường phản hồi trong vòng 8 ngày
-
2.x telemetry
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3564 ·
Maintainer thường phản hồi trong vòng 8 ngày
-
2.x telemetry
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Azure/data-api-builder#3562 ·
Maintainer thường phản hồi trong vòng 8 ngày
Tất cả issue của Azure/data-api-builder
Issue tương tự
-
agentic-workflows area/Docs partner/agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/fluentui-blazor#5364 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
microsoft/agent-framework#8811 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET Docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
getsentry/sentry-dotnet#5637 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
QuantConnect/Lean#9842 ·
Maintainer thường phản hồi trong vòng 1 ngày