Skip to content
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

Can firebase-admin run data-connect generated queries and mutations #2823

Open
r-bt opened this issue Dec 29, 2024 · 1 comment
Open

Can firebase-admin run data-connect generated queries and mutations #2823

r-bt opened this issue Dec 29, 2024 · 1 comment

Comments

@r-bt
Copy link

r-bt commented Dec 29, 2024

I'm trying to have a firebase function run a mutation for data connect. From reading here: https://firebase.google.com/docs/data-connect/admin-sdk this seems possible:

Since the Admin SDK operates with privileges, it can execute any of your queries and mutations regardless of access levels set using @auth directives, including the NO_ACCESS level.

However, it is not possible to pass the output of getDataConnect from firebase-admin/data-connect to a generated doMutationRef as the types don't match up.

For example when I try do this:

import { getDataConnect } from 'firebase-admin/data-connect';

const dataConnect = getDataConnect({
  serviceId: "PrepIt",
  location: "europe-west2",
});

import { createOrganisationRef} from 'dataconnect/generated'

createOrganisationRef(dataConnect, {
      organisationId: organisationID,
      userId: 'userId',
      role: 'Admin',
      isSupport: true,
});

it gives me the following error:

Argument of type 'import("/Users/richard/Documents/PrepIt/functions/node_modules/firebase-admin/lib/data-connect/data-connect").DataConnect' is not assignable to parameter of type 'import("/Users/richard/Documents/PrepIt/node_modules/@firebase/data-connect/dist/public").DataConnect'.
  Type 'DataConnect' is missing the following properties from type 'DataConnect': dataConnectOptions, isEmulator, getSettings, setInitialized, enableEmulatorts(2345)
@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

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

No branches or pull requests

3 participants