[REQUIRED] Environment info
firebase-tools: 14.24.2
Platform: macOS Sequoia 15.6.1
[REQUIRED] Test case
GraphQL Schema (Minimal Example)
Create a simple Data Connect query with no input variables:
File: dataconnect/connector/GetItems.gql
query GetItems @auth(level: NO_ACCESS) {
items {
id
name
}
}
File: dataconnect/connector/connector.yaml
connectorId: "default"
generate:
adminNodeSdk:
outputDir: "./generated/admin"
package: "@firebasegen/connector-admin"
Generated Code (BROKEN)
Run firebase dataconnect:sdk:generate and the generator produces:
function getItems(dcOrOptions, options) {
const { dc: dcInstance, options: inputOpts} = validateAdminArgs(connectorConfig, dcOrOptions, options, undefined);
dcInstance.useGen(true);
return dcInstance.executeQuery('GetItems', inputVars, inputOpts); // ❌ inputVars is undefined!
};
[REQUIRED] Steps to reproduce
-
Create a GraphQL query with no input variables:
mkdir -p dataconnect/connector
cat > dataconnect/connector/GetItems.gql << EOF
query GetItems @auth(level: NO_ACCESS) {
items {
id
name
}
}
EOF
-
Configure connector.yaml with adminNodeSdk:
connectorId: "default"
generate:
adminNodeSdk:
outputDir: "./generated/admin"
package: "@firebasegen/connector-admin"
-
Generate the Admin SDK:
firebase dataconnect:sdk:generate
-
Try to use the generated function:
import { getItems } from './generated/admin';
import { getDataConnect } from 'firebase-admin/data-connect';
const dataConnect = getDataConnect({
serviceId: 'my-service',
location: 'us-central1'
});
// This will fail with ReferenceError
await getItems(dataConnect);
-
Observe the error:
ReferenceError: inputVars is not defined
[REQUIRED] Expected behavior
The generated code should pass undefined (or omit the parameter) for operations with no variables:
Expected (Working) Code:
function getItems(dcOrOptions, options) {
const { dc: dcInstance, options: inputOpts} = validateAdminArgs(connectorConfig, dcOrOptions, options, undefined);
dcInstance.useGen(true);
return dcInstance.executeQuery('GetItems', undefined, inputOpts); // ✅ undefined instead of inputVars
};
Alternative (also correct): Use the 2-argument overload:
function getItems(dcOrOptions, options) {
const { dc: dcInstance, options: inputOpts} = validateAdminArgs(connectorConfig, dcOrOptions, options, undefined);
dcInstance.useGen(true);
return dcInstance.executeQuery('GetItems', inputOpts); // ✅ 2-argument form
};
[REQUIRED] Actual behavior
Error Message:
ReferenceError: inputVars is not defined
at getItems (generated/admin/index.cjs.js:34:51)
at async main (index.js:10:18)
Debug Output:
When running with --debug, the Firebase CLI generates the SDK without errors, but the generated code itself contains the bug. The issue is in the code generator template, not the CLI execution.
[REQUIRED] Environment info
firebase-tools: 14.24.2
Platform: macOS Sequoia 15.6.1
[REQUIRED] Test case
GraphQL Schema (Minimal Example)
Create a simple Data Connect query with no input variables:
File:
dataconnect/connector/GetItems.gqlFile:
dataconnect/connector/connector.yamlGenerated Code (BROKEN)
Run
firebase dataconnect:sdk:generateand the generator produces:[REQUIRED] Steps to reproduce
Create a GraphQL query with no input variables:
Configure
connector.yamlwithadminNodeSdk:Generate the Admin SDK:
Try to use the generated function:
Observe the error:
[REQUIRED] Expected behavior
The generated code should pass
undefined(or omit the parameter) for operations with no variables:Expected (Working) Code:
Alternative (also correct): Use the 2-argument overload:
[REQUIRED] Actual behavior
Error Message:
Debug Output:
When running with
--debug, the Firebase CLI generates the SDK without errors, but the generated code itself contains the bug. The issue is in the code generator template, not the CLI execution.