diff --git a/.changeset/rotten-wombats-shop.md b/.changeset/rotten-wombats-shop.md new file mode 100644 index 00000000000..bf36818339e --- /dev/null +++ b/.changeset/rotten-wombats-shop.md @@ -0,0 +1,5 @@ +--- +'@firebase/database': patch +--- + +Fix `index not defined` errors for orderByChild get requests diff --git a/packages/database/src/core/Repo.ts b/packages/database/src/core/Repo.ts index d3938a75cc0..9479f620529 100644 --- a/packages/database/src/core/Repo.ts +++ b/packages/database/src/core/Repo.ts @@ -466,7 +466,9 @@ export function repoGetValue(repo: Repo, query: QueryContext): Promise { } return repo.server_.get(query).then( payload => { - const node = nodeFromJSON(payload as string); + const node = nodeFromJSON(payload as string).withIndex( + query._queryParams.getIndex() + ); const events = syncTreeApplyServerOverwrite( repo.serverSyncTree_, query._path,