Skip to content

Credentials are required when connecting to the Data Connect Emulator #2843

@aalej

Description

@aalej

[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 Sonoma 14.7.2
  • Firebase SDK version: Firebase Admin v13.1.0
  • Firebase Product: Data Connect
  • Node.js version: v22.13.1
  • NPM version: v10.9.2

[REQUIRED] Step 3: Describe the problem

An error is raised when performing a query and no credentials is passed. From what I can gather, when connecting to the Auth emulator or Firestore emulator, credentials are not required.

Steps to reproduce:

Test case with steps to repro and outputs in: https://github.com/aalej/firebase-admin-2843

Relevant Code:

import { cert, initializeApp } from 'firebase-admin/app';
import { getDataConnect } from 'firebase-admin/data-connect';

process.env.DATA_CONNECT_EMULATOR_HOST = "http://127.0.0.1:9399"

initializeApp({
    projectId: "demo-project",
    // credential: {
    //     getAccessToken: () => Promise.resolve({ access_token: 'fake-access-token', expires_in: 3600 }),
    // }
});

const dataConnect = getDataConnect({
    location: "us-central1",
    serviceId: "test-dc-2"
});

async function main() {
    const query = "query ListMovies { movies { id } }";
    const gqlResponse = await dataConnect.executeGraphql(query);
    console.log(JSON.stringify(gqlResponse))
}

main()

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions