Skip to content

dataconnect-emulator-3.3.1: sdk:generate fails with ImportsTS wrong number of args #10227

@m47een

Description

@m47een

Environment info

firebase-tools: 15.12.0
Platform: Linux (WSL2, also reproduces on GitHub Actions Ubuntu runners)
dataconnect-emulator: 3.3.1 (bundled with firebase-tools 15.12.0)

Bug description

firebase dataconnect:sdk:generate fails with a Go template error in dataconnect-emulator-3.3.1. The ImportsTS template function now requires 2 arguments (the second being ClientCache), but the emulator only passes 1.

Steps to reproduce

  1. Install firebase-tools@15.12.0
  2. Have a connector.yaml with javascriptSdk configured (with or without clientCache: {})
  3. Run firebase dataconnect:sdk:generate

Error output

I0331 17:06:10.835010 jsgen.go:146] Embedded file index.d.ts.go.tmpl
E0331 17:06:16.627776 generate_cmd.go:51] Failed to generate SDKs:
[connector "deliverables" javascriptSdk]: failed to generate sources:
failed to parse template: template: index.d.ts.go.tmpl:4:12: executing "index.d.ts.go.tmpl" at <ImportsTS>: wrong number of args for ImportsTS: want 2 got 1

Error: An unexpected error has occurred.

Investigation

Running the emulator with verbose logging (-v=5) confirms:

  • The emulator reads clientCache from connector.yaml correctly:
    "ClientCache": { "MaxAge": "", "MaxSize": "", "Storage": "" }
    
  • But it does not propagate the ClientCache value to the ImportsTS Go template function

The Go template index.d.ts.go.tmpl at line 4 calls ImportsTS which now expects 2 arguments (OperationsUsed and ClientCache), but only receives 1.

Workaround

Pin firebase-tools to 15.11.0, which bundles dataconnect-emulator-3.3.0 (the template works correctly in 3.3.0).

npm install -g firebase-tools@15.11.0

connector.yaml (minimal reproduction)

connectorId: myConnector
generate:
  javascriptSdk:
    - outputDir: ./generated
      package: "@myapp/generated"
      packageJsonDir: .
      clientCache: {}

Expected behaviour

SDK generation should succeed, as it does with dataconnect-emulator-3.3.0.

Actual behaviour

SDK generation fails with the ImportsTS template error regardless of whether clientCache is present in connector.yaml.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions