-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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