Skip to content

emulators, dataconnect, local postgres, graphql issue after upgrade 14.25.1 -> 14.26.0 #9508

@portah

Description

@portah

[REQUIRED] Environment info

nodejs: 20.19.5
export FIREBASE_DATACONNECT_POSTGRESQL_STRING=postgres://localhost:5432/postgres?sslmode=disable
export DATA_CONNECT_EMULATOR_HOST='127.0.0.1:9399'

firebase-tools:
14.25.1 & 14.26.0

Platform:
MacOS

[REQUIRED] Test case

# UserProfile extends User with additional profile information and 2FA settings
type UserProfile @table(key: "uid") {
  # Links to Firebase Auth UID - this is the primary key
  uid: String! @default(expr: "auth.uid")
  email: String! @col(dataType: "varchar(255)")
  firstName: String @col(dataType: "varchar(50)")
  lastName: String @col(dataType: "varchar(50)")
  phoneNumber: String @col(dataType: "varchar(20)")
  photoURL: String @col(dataType: "varchar(500)")
  role: String @col(dataType: "varchar(50)")

  # 2FA related fields
  twoFactorEnabled: Boolean! @default(value: false)
  twoFactorSecret: String @col(dataType: "varchar(32)") # Base32 encoded secret for authenticator apps
  backupCodes: [String!] # Array of backup codes for 2FA recovery

  # Profile metadata
  createdAt: Timestamp! @default(expr: "request.time")
  updatedAt: Timestamp! @default(expr: "request.time")
  lastLoginAt: Timestamp

  # User preferences
  language: String @col(dataType: "varchar(10)") @default(value: "en")
  timezone: String @col(dataType: "varchar(50)")

  # Account status - 'pending' (not signed in yet), 'active', 'inactive', 'suspended'
  status: String! @col(dataType: "varchar(20)") @default(value: "pending")
  isDeleted: Boolean! @default(value: false)
}

# Get current user's profile based on their auth.uid
query GetUserProfile @auth(level: USER_EMAIL_VERIFIED) {
    userProfile(key: { uid_expr: "auth.uid" }) {
        uid
        email
        firstName
        lastName
        phoneNumber
        photoURL
        role
        twoFactorEnabled
        language
        timezone
        status
        createdAt
        updatedAt
        lastLoginAt
    }
}

import {
    getUserProfile,
} from '@dataconnect/generated';

    async getUserProfile(): Promise<GetUserProfileData> {
        if (this.userProfileData) {
            return this.userProfileData;
        }
        this.userProfileData = (await getUserProfile(this.dataConnect as any)).data;
        return this.userProfileData;
    }

on the emulators side when use firebase tools 14.25.1

I1122 11:33:21.301175   39652 engine.go:172] [/emulator/xxx-xxxon-development 6489] ExecuteGraphql : succeeded. 
I1122 11:33:22.347075   39652 prepare.go:158] [operation "GetUserProfile" attempt 1] preparePlan succeeded
I1122 11:33:22.347103   39652 prepare.go:145] [operation "GetUserProfile" attempt 1] 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}
I1122 11:33:22.363611   39652 executor.go:92] [operation "GetUserProfile" attempt 1] DBStats beforeRun: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:0, Idle:1, WaitCount:0, WaitDuration:0, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}, afterRun: sql.DBStats{MaxOpenConnections:1, OpenConnections:1, InUse:0, Idle:1, WaitCount:0, WaitDuration:0, MaxIdleClosed:0, MaxIdleTimeClosed:0, MaxLifetimeClosed:0}
I1122 11:33:22.363677   39652 engine.go:172] [/emulator/xxx-xxxon-development 6489] ExecuteQuery GetUserProfile: succeeded. Connector: xxx-xxxon

And when update to firebase tools 14.26.0

I1122 11:47:11.653282   48808 engine.go:179] [/emulator/xxx-xxxon-development 7898] ExecuteGraphql : succeeded. 
W1122 11:47:12.688665   48808 engine.go:177] [/emulator/xxx-xxxon-development 7898] ExecuteQuery GetUserProfile: failed with explicit status error: rpc error: code = Internal desc = internal error: unexpected internal error has occurred. Connector: xxx-xxxon
Auth: user of {"UID":"HAe54sikpSjT5bvmRyIAzWjPlGhM","Token":{"aud":"XXX-XXXon","auth_time":1763830031,"email":"myemail@example.com","email_verified":true,"exp":1763833631,"firebase":{"identities":{"email":["myemail@example.com"]},"sign_in_provider":"password"},"iat":1763830031,"iss":"https://securetoken.google.com/xxx-xxxon","name":"","picture":"","role":"admin","sub":"HAe54sikpSjT5bvmRyIAzWjPlGhM","user_id":"HAe54sikpSjT5bvmRyIAzWjPlGhM"}}
Status: rpc error: code = Internal desc = internal error: unexpected internal error has occurred
sources: xxx/mutations.gql [30226B] xxx/queries.gql [27779B] 

[REQUIRED] Steps to reproduce

see above

run generated function getUserProfile from a browser and emulators can't finish the graphQl execution

[REQUIRED] Expected behavior

do not crush

[REQUIRED] Actual behavior

crushing

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions