Repository navigation
Description
[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.yamlwithadminNodeSdk: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.
Activity
aalej commentedon Nov 12, 2025
Thanks for the detailed report @jdiekhoff, this is appreciated! I was able to reproduce the issue and it does seem like there's an error in the generated code. I'll raise this to our engineering team so they can take a look.
sharing mcve here https://github.com/aalej/issues-9449
aalej commentedon Nov 17, 2025
I'll go ahead and close this, this issue should be fixed by #9454 which is included in the firebase-tools v14.25.0 release. Also did a quick test to verify the fix https://github.com/aalej/issues-9449?tab=readme-ov-file#post-fix-14250.