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

Missing export for functions and getFuncitons #1704

Closed
gitdast opened this issue May 14, 2022 · 9 comments
Closed

Missing export for functions and getFuncitons #1704

gitdast opened this issue May 14, 2022 · 9 comments

Comments

@gitdast
Copy link

gitdast commented May 14, 2022

[REQUIRED] Step 2: Describe your environment

Windows, Node.js
Firebase SDK version: latest firebase-admin = 10.2.0
Firebase Product: Cloud Functions (+ Auth, Firestore,...)
Node.js version: 16
NPM version: 8.1.0

[REQUIRED] Step 3: Describe the problem

I want to use TaskQueue with Cloud Functions as described here https://firebase.google.com/docs/functions/task-functions,
but neither firebase-functions SDK v3.21.1 nor firebase-admin SDK v10.2.0 has export for all described functions.
There is missing export for getFunctions in firebase-admin v10.2.0.
(Why is not TaskQueue related stuff present in firebase-functions SDK and we have to use two SDK in CF...that's another question.)

Steps to reproduce:

What happened? How can we make the problem occur?
This could be a description, log/console output, etc.

Relevant Code:

import {getFunctions} from 'firebase-admin' - this will never work
@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.

@gitdast
Copy link
Author

gitdast commented May 14, 2022

I have found an option how to import by

import {getFunctions} from 'firebase-admin/functions';

but there is another issue - this function getFunctions has no option to specify the region - so all queues must be in us-central1 ?
image
image
As I'm not able to specify the region - it will trigger "Queue not found."
If I place the queue in the us-central1 - it's working OK.

@lahirumaramba
Copy link
Member

Hi @gitdast ,

You are correct, the right way to import functions types is

import { getFunctions, TaskOptions } from 'firebase-admin/functions'

The default region is us-central1, but you can specify a different region in the getFunctions().taskQueue() API by passing it in the function resource name.

getFunctions().taskQueue('locations/{location}/functions/{functionName}')

See the reference docs for more information:
https://firebase.google.com/docs/reference/admin/node/firebase-admin.functions.functions#functionstaskqueue

@gitdast
Copy link
Author

gitdast commented May 16, 2022

Thank you, it was hard to find these two information.
Maybe consider exposing getFunctions from the top module and unify the syntax with the firebase SDK...
image

@gijo-varghese
Copy link

@gitdast did you find a solution? I'm still facing the same issue: #1761

@dastrouvy
Copy link

dastrouvy commented Jun 13, 2022

@gitdast did you find a solution? I'm still facing the same issue: #1761

Yes, as mentioned above - import {getFunctions} from 'firebase-admin/functions';

There is an export in node_modules/firebase-admin/lib/functions/index.d.ts

@gijo-varghese
Copy link

gijo-varghese commented Jun 13, 2022

@dastrouvy I’m not using Babel/ES6, do you know the similar syntax with require?

@gijo-varghese
Copy link

@dastrouvy upgrading to firebase-admin to latest fixed the issue.

@ShanahJr
Copy link

ShanahJr commented Oct 7, 2022

Upgrading to the latest firebase-admin (11.1.0) allowed me to access the queueing functions it is incompatible with the latest firebase-functions (3.24.1). Breaking changes for me

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

6 participants