Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aalej opened this issue Feb 10, 2025 · 2 comments · Fixed by #2853
Closed

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

aalej opened this issue Feb 10, 2025 · 2 comments · Fixed by #2853

Comments

@aalej
Copy link

aalej commented Feb 10, 2025

[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()
@maneesht
Copy link
Contributor

Hi, I'm not able to reproduce this, what error are you getting?

@lahirumaramba
Copy link
Member

Thanks @aalej for filing this issue and providing us with a repro. This looks like a bug in the SDK. We will work on a fix soon and use this issue to track the progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants