[BUG] BigQuery api_endpoint not honored (follow-up to #1514)
Describe the bug
#1514 added api_endpoint support so BigQuery traffic could be routed through a custom proxy or emulator. The fix correctly routes REST API traffic to the configured host, but it does not route Storage Read API gRPC traffic. Because Fusion requires the Storage Read API to fetch query results (per the BigQuery setup docs — BigQuery Read Session User is a new mandatory permission as of Fusion), this means dbt debug and any other command fail end-to-end when api_endpoint is set to a non-Google host, with the error:
[BigQuery] Storage API is not available for query: https://console.cloud.google.com/bigquery?project=<project>&j=bq::<job_id>&page=queryresultsWhat version of dbt Fusion is this bug in? (find out by running dbt --version)
dbt-fusion 2.0.0-preview.173
Is this a discrepancy between the dbt Fusion Engine and dbt Core? Check one.
- YES
- NO
To Reproduce
- Install goccy/bigquery-emulator (any recent version — it implements both REST and Storage Read API gRPC; verified in server/storage_handler.go).
- Start it locally:
bigquery-emulator \
--project=my-project \
--dataset=my_dataset \
--port=9050 \
--grpc-port=9060 \
--log-level=debugYou should see both:
[bigquery-emulator] REST server listening at 0.0.0.0:9050
[bigquery-emulator] gRPC server listening at 0.0.0.0:9060- Configure a BigQuery profile pointing at it:
bq:
target: dev
outputs:
dev:
type: bigquery
method: service-account
keyfile: /path/to/any.json
database: my-project
schema: my_dataset
threads: 1
api_endpoint: http://localhost:9050- Run
dbt debug --profile bqObserved behavior: The emulator logs every REST call:
POST /projects/my-project/jobs (submit "select 1 as id")
GET /projects/my-project/queries/<job_id> (with maxResults=0)
GET /projects/my-project/jobs/<job_id> (status check)Zero traffic on the emulator's gRPC port (9060). The emulator's BigQueryRead service is never invoked.
dbt debug errors with:
aeriel@bq %dbtf debug
dbt-fusion 2.0.0-preview.173
Loading ~/.dbt/profiles.yml
Debugging profile: dev
Debugging dbt version: 2.0.0-preview.173
Debugging platform: macos aarch64 (unix)
Debugging adapter type: bigquery (remote)
Debugging dependencies:
git: OK
Debugging connection:
"database": "cse-sandbox-xxxx",
"schema": "dbt_asoriano_fs_local",
"method": "service-account",
"api_endpoint": "http://localhost:9050",
"dataproc_batch": null
New version available 2.0.0-preview.175 (run `dbt system update`)
======================================================================= Errors and Warnings ========================================================================
error: dbt1011: dbt was unable to connect to the specified database.
The following error was returned:
[BigQuery] Storage API is not available for query: https://console.cloud.google.com/bigquery?project=xxxxx&j=bq::mPoqNEfj64LhlLpCYwXpzqMVE8e&page=queryresults
Check your database credentials and try again. For more information, visit:
https://docs.getdbt.com/docs/core/connect-data-platform/connection-profiles(The error string "Storage API is not available" is not in the emulator's source — confirmed via grep. It is generated by Fusion.)
Observation:
| Question | Result | Evidence |
|---|---|---|
Does Fusion route REST to api_endpoint? |
✅ Yes | Emulator logged POST /jobs, GET /queries, GET /jobs on :9050 |
| Does Fusion route Storage Read API gRPC to the same host? | ❌ No | Zero traffic on :9060 |
| Does dbtf debug succeed? | ❌ No | [BigQuery] Storage API is not available for query |
Expected behavior
When api_endpoint is configured, Fusion should route all BigQuery API traffic to that host — including Storage Read API gRPC, not just REST. Either:
- The Storage Read API gRPC call should target the same host as
api_endpoint(with a corresponding gRPC port — possibly inferred or via a related config option), or - Fusion should provide a way to opt out of Storage Read API and fall back to REST result fetching (matching classic dbt-bigquery behavior) when
api_endpointis set.
Operating System and CPU Type (please complete the following information):
- Mac/Windows/Linux? Mac
- X86 or ARM? ARM64
Source: dbt-labs/dbt-core