-
Notifications
You must be signed in to change notification settings - Fork 410
Description
[READ] Step 1: Are you in the right place?
- For issues related to the code in this repository file a Github issue.
- If the issue pertains to Cloud Firestore, read the instructions in the "Firestore issue"
template. - For general technical questions, post a question on StackOverflow
with the firebase tag. - For general Firebase discussion, use the firebase-talk
google group. - For help troubleshooting your application that does not fall under one
of the above categories, reach out to the personalized
Firebase support channel.
[REQUIRED] Step 2: Describe your environment
- Operating System version: macOS
- Firebase SDK version: firebase-admin 13.6.0
- Firebase Product: Data Connect
- Node.js version: 24.12
- NPM version: 11.6.2
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
-
Use the minimal GraphQL schema with an enum and a table referencing it.
-
Initialize the Firebase Admin app and get a Data Connect instance (optionally connect to the Data Connect emulator).
-
Attempt to insert a row using
dc.insert("ticker", { symbol: "TEST", status: "PRIMARY" }).
The operation fails with a GraphQL validation error indicating that the enum value is being sent as a quoted string instead of an unquoted enum literal.
Tested only in the Data Connect emulator.
Relevant Code:
Minimal schema (dataconnect/schema/schema.graphql):
enum TickerStatus {
PRIMARY
ACTIVE
HISTORICAL
}
type Ticker @table {
symbol: String!
status: TickerStatus!
}
Minimal Node.js script to reproduce:
import { getDataConnect } from "firebase-admin/data-connect";
import admin from "firebase-admin";
admin.initializeApp();
// For emulator testing:
// process.env.DATA_CONNECT_EMULATOR_HOST = "127.0.0.1:9399";
const dc = getDataConnect({
location: "us-west2", // or your location
serviceId: "your-service-id",
});
async function testInsert() {
try {
await dc.insert("ticker", {
symbol: "TEST",
status: "PRIMARY", // string matching enum literal
});
console.log("Success");
} catch (error) {
console.error("Error:", error);
}
}
testInsert();Additional environment info:
- firebase-tools: 15.0.0
Actual behavior
The insert fails with a GraphQL error such as:
"Cannot represent non-enum value: \"PRIMARY\" as enum type TickerStatus!"
or similar ("Expected type TickerStatus!, found "PRIMARY"").
This suggests that the Admin SDK is serializing the enum value as an inline quoted string in the generated mutation (e.g., status: "PRIMARY"), which GraphQL servers reject for enum types (enums must be unquoted literals when sent inline).
Expected behavior
The insert should succeed, with the SDK properly handling enum values by sending them as unquoted enum literals in the mutation payload.
This limitation impacts bulk data seeding and administrative scripts that rely on the convenient insert/update methods for schemas with enums. Thank you for investigating!