Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: Table writes fail (HTTP 500) for entities defined in a linked `data-source-files` config

Aperta
#3,701 0 commenti 2 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@souvikghosh04 ci sta già lavorando.

Dal 7/7/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

config cri

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 execute path, not the table-mutation path).
  • Only table mutations (POST/PUT/PATCH/DELETE) on linked-file entities fail.
  • dab validate passes 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.

Lingua principale
C#
Stelle
1.5k
Fork
371
Merge medio
9g 2h
PR unite (30g)
10

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/data-api-builder

Tutte le issue di Azure/data-api-builder

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.