Repository navigation
Closed
Labels
emulator: dataconnectIssues related to the dataconnect emulatorIssues related to the dataconnect emulatorpriority: p1readyPRs that have full approval and no outstanding discussionPRs that have full approval and no outstanding discussionreproducibletype: bug
Description
When doing a Data Connect transaction mutation the request hangs.
- This happens on
firebase-toolsversion 15.3.0- 15.2.0 is stable.
- Specifically, I believe it comes from the
Update Data Connect Emulator to 3.0.2PR (Data Connect Emulator release v3.0.2 #9738). - Also tested on a NEW flutter and firebase project with the same results.
- This also happens on version 15.3.1 but that looks like it was just MCP updates.
[REQUIRED] Environment info
firebase-tools: 15.3.0, 15.3.1
Platform: Windows 11 Pro
Application SDK: Flutter
[REQUIRED] Test case
Tested with a simple transaction mutation.
Schema:
type Test @table(name: "test_tests") {
id: Int64!
message: String
}Mutation Transaction:
mutation TransactionTest(
$id: Int64!
$message: String!
$updateMessage: String!
) @transaction @auth(level: PUBLIC) {
query
@redact
@check(
expr: "response.query.existingTest == null"
message: "Test record already exists!"
) {
existingTest: test(first: { where: { id: { eq: $id } } }) {
id
message
}
}
insert: test_insert(data: { id: $id, message: $message })
update: test_update(
first: { where: { id: { eq_expr: "response.insert.id" } } }
data: { message: $updateMessage }
)
}[REQUIRED] Steps to reproduce
- Install firebase-tools 15.3.0
- Copy in the simple transaction mutation provided
- Run
firebase emulators:start --debug - Trigger a Data Connect transaction mutation that writes to the DB
- Request hangs indefinitely
- Restart application, emulator crashes
NOTE: If you downgrade to firebase-tools 15.2.0 it works.
[REQUIRED] Expected behavior
Transaction mutation completes and doesn't infinitely hang.
[REQUIRED] Actual behavior
I suspect this excerpt from the full log result below:
Error: Unexpected initial message
at _class5.handleClientMessage (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\pg-gateway\dist\chunk-FCOSUQFU.cjs:1:212007)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
at async _class5.processData (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\pg-gateway\dist\chunk-FCOSUQFU.cjs:1:211063)
at async _class5.init (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\pg-gateway\dist\chunk-FCOSUQFU.cjs:1:209869)
!! dataconnect: Postgres threw an unexpected error, shutting down the Data Connect emulator: AbortError: The operation was aborted {"metadata":{"emulator":{"name":"dataconnect"},"message":"Postgres threw an unexpected error, shutting down the Data Connect emulator: AbortError: The operation was aborted"}}
Log after running the transaction.
[2026-01-16T19:12:24.688Z] I0116 13:12:24.688136 47764 prepare.go:110] [operation "TransactionTest"] preparePlan succeeded
I0116 13:12:24.688136 47764 prepare.go:101] [operation "TransactionTest"] DBStats beforePrepare: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:0, Idle:1, WaitCount:0, WaitDuration:0, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}, afterPrepare: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:0, Idle:1, WaitCount:0, WaitDuration:0, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}
{"metadata":{"emulator":{"name":"dataconnect"},"message":"I0116 13:12:24.688136 47764 prepare.go:110] [operation \"TransactionTest\"] preparePlan succeeded\nI0116 13:12:24.688136 47764 prepare.go:101] [operation \"TransactionTest\"] DBStats beforePrepare: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:0, Idle:1, WaitCount:0, WaitDuration:0, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}, afterPrepare: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:0, Idle:1, WaitCount:0, WaitDuration:0, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}\n"}}
Same log session, but after I reloaded the app because of the hang ~5 minutes later; emulator crashes
runQuery DEALLOCATE ALL [] undefined
[2026-01-16T19:18:08.302Z] Postgres client disconnected
[2026-01-16T19:18:08.302Z] E0116 13:18:08.299339 47764 execute.go:47] Database ping failed: input:
after 5m43.610117s
stats before: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:1, Idle:0, WaitCount:0, WaitDuration:0, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}
stats After: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:1, Idle:0, WaitCount:1, WaitDuration:343610117000, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}
E0116 13:18:08.300386 47764 transaction.go:29] failed to rollback transaction: sql: transaction has already been committed or rolled back
W0116 13:18:08.300916 47764 engine.go:182] [/emulator/firebase 3004] ExecuteMutation TransactionTest: failed. Connector: core
Auth: public
Variables Set:
[id message updateMessage]
Errors: [message:"Database is not available\nTest record already exists! (aborted)" path:{values:{string_value:"query"}} extensions:{debug_details:"cannot reach the database: context canceled\n@check(expr) rejected the request: denied due to error: input: \n (aborted)\nCheck Requirement Evaluated: Every(path: query, DenyUnlessTrue(CEL(\"response.query.existingTest == null\" -> Boolean)))"} message:"(aborted)" path:{values:{string_value:"insert"}} message:"(aborted)" path:{values:{string_value:"update"}}]
Data Fields:
[insert update]
sources: core\users\mutations.gql [5025B] core\posts\mutations.gql [2962B] core\interactions\mutations.gql [1283B] core\interactions\queries.gql [1435B] core\comments\fragments.gql [527B] core\users\fragments.gql [228B] core\users\queries.gql [1651B] core\posts\fragments.gql [473B] core\posts\queries.gql [2192B] core\interactions\fragments.gql [201B] core\comments\mutations.gql [2999B] core\comments\queries.gql [1441B] core\test\mutations.gql [865B]
{"metadata":{"emulator":{"name":"dataconnect"},"message":"E0116 13:18:08.299339 47764 execute.go:47] Database ping failed: input: \n after 5m43.610117s\nstats before: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:1, Idle:0, WaitCount:0, WaitDuration:0, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}\nstats After: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:1, Idle:0, WaitCount:1, WaitDuration:343610117000, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}\nE0116 13:18:08.300386 47764 transaction.go:29] failed to rollback transaction: sql: transaction has already been committed or rolled back\nW0116 13:18:08.300916 47764 engine.go:182] [/emulator/firebase 3004] ExecuteMutation TransactionTest: failed. Connector: core\nAuth: public\nVariables Set:\n[id message updateMessage]\nErrors: [message:\"Database is not available\\nTest record already exists! (aborted)\" path:{values:{string_value:\"query\"}} extensions:{debug_details:\"cannot reach the database: context canceled\\n@check(expr) rejected the request: denied due to error: input: \\n (aborted)\\nCheck Requirement Evaluated: Every(path: query, DenyUnlessTrue(CEL(\\\"response.query.existingTest == null\\\" -> Boolean)))\"} message:\"(aborted)\" path:{values:{string_value:\"insert\"}} message:\"(aborted)\" path:{values:{string_value:\"update\"}}]\nData Fields:\n[insert update]\nsources: core\\users\\mutations.gql [5025B] core\\posts\\mutations.gql [2962B] core\\interactions\\mutations.gql [1283B] core\\interactions\\queries.gql [1435B] core\\comments\\fragments.gql [527B] core\\users\\fragments.gql [228B] core\\users\\queries.gql [1651B] core\\posts\\fragments.gql [473B] core\\posts\\queries.gql [2192B] core\\interactions\\fragments.gql [201B] core\\comments\\mutations.gql [2999B] core\\comments\\queries.gql [1441B] core\\test\\mutations.gql [865B] \n"}}
Error: Unexpected initial message
at _class5.handleClientMessage (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\pg-gateway\dist\chunk-FCOSUQFU.cjs:1:212007)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
at async _class5.processData (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\pg-gateway\dist\chunk-FCOSUQFU.cjs:1:211063)
at async _class5.init (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\pg-gateway\dist\chunk-FCOSUQFU.cjs:1:209869)
!! dataconnect: Postgres threw an unexpected error, shutting down the Data Connect emulator: AbortError: The operation was aborted {"metadata":{"emulator":{"name":"dataconnect"},"message":"Postgres threw an unexpected error, shutting down the Data Connect emulator: AbortError: The operation was aborted"}}
i emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
i ui: Stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Stopping Emulator UI"}}
i extensions: Stopping Extensions Emulator {"metadata":{"emulator":{"name":"extensions"},"message":"Stopping Extensions Emulator"}}
[2026-01-16T19:18:08.307Z] [Extensions] Stopping Extensions emulator, this is a noop.
i functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
i firestore: Stopping Firestore Emulator {"metadata":{"emulator":{"name":"firestore"},"message":"Stopping Firestore Emulator"}}
! Firestore Emulator has exited upon receiving signal: SIGINT
i pubsub: Stopping Pub/Sub Emulator {"metadata":{"emulator":{"name":"pubsub"},"message":"Stopping Pub/Sub Emulator"}}
! Pub/Sub Emulator has exited upon receiving signal: SIGINT
i auth: Stopping Authentication Emulator {"metadata":{"emulator":{"name":"auth"},"message":"Stopping Authentication Emulator"}}
i storage: Stopping Storage Emulator {"metadata":{"emulator":{"name":"storage"},"message":"Stopping Storage Emulator"}}
[2026-01-16T19:18:08.330Z] Stopping rules runtime. {"metadata":{"emulator":{"name":"storage"},"message":"Stopping rules runtime."}}
i eventarc: Stopping Eventarc Emulator {"metadata":{"emulator":{"name":"eventarc"},"message":"Stopping Eventarc Emulator"}}
i dataconnect: Stopping Data Connect Emulator {"metadata":{"emulator":{"name":"dataconnect"},"message":"Stopping Data Connect Emulator"}}
# 108:fake shutdown
# skipped shmem_exit_index=5/6
# before_shmem_exit_index=4/6
2026-01-16 19:18:08.346 GMT [0] LOG: shutting down
2026-01-16 19:18:08.347 GMT [0] DEBUG: performing replication slot checkpoint
# skipped shmem_exit_index=3/6
# skipped shmem_exit_index=2/6
# skipped shmem_exit_index=1/6
# skipped shmem_exit_index=0/6
# dsm_backend_shutdown ?
! Data Connect Emulator has exited upon receiving signal: SIGINT
i tasks: Stopping Cloud Tasks Emulator {"metadata":{"emulator":{"name":"tasks"},"message":"Stopping Cloud Tasks Emulator"}}
i hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
i logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
Metadata
Metadata
Assignees
Labels
emulator: dataconnectIssues related to the dataconnect emulatorIssues related to the dataconnect emulatorpriority: p1readyPRs that have full approval and no outstanding discussionPRs that have full approval and no outstanding discussionreproducibletype: bug
Activity
aalej commentedon Jan 19, 2026
Thanks for the detailed report @l1qu1d, I appreciate this! I was able to reproduce the issue, and as you mentioned, it is not reproducible on versions before 15.3.0. I'll raise this to our engineering team and will mark this as reproducible.
sharing the mcve here - https://github.com/aalej/issues-9756
l1qu1d commentedon Jan 19, 2026
Thanks @aalej. I'm surprised this wasn't caught via testing. All database mutation types should have to go through tests before release for the Data Connect Emulator. I would like you to also suggest to the team that they please do so.
fredzqm commentedon Jan 20, 2026
Thank you for @aalej !
This is a pretty bad regression. I will looking into it shortly.
Yeah, our e2e test coverages in emulator + pglite is pretty limited right now.
We have good unit tests for core engine + Postgres, but quite limited for core engine + pglite.
l1qu1d commentedon Jan 20, 2026
I'm not sure what your limits are on the emulator + pglite but I believe it need to be a priority for your team. Many users and paying clients use the emulator (development & testing) before even touching production.
fredzqm commentedon Jan 21, 2026
I fully agree that it is very important~
Emulator is an absolute critical part of Firebase Data Connect product. We are committed to keep it stable and up to date~
@l1qu1d Thank you for the kind feedbacks and raising this bug!
Sorry about the inconvenience caused
fredzqm commentedon Jan 21, 2026
Root caused the underlying issue.
It turns out to be a one-line fix. A CLI release will be cut later today.
Thanks again for raising this bug quickly to our team!!