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

6.0.0 Property 'region' does not exist on type 'typeof import #1614

Open
davie-robertson opened this issue Sep 15, 2024 · 6 comments
Open

6.0.0 Property 'region' does not exist on type 'typeof import #1614

davie-robertson opened this issue Sep 15, 2024 · 6 comments

Comments

@davie-robertson
Copy link

Related issues

No - checked ChangeLog too

[REQUIRED] Version info

upgrade from ^5.1.1 to ^6.0.0

node:

v20.15.0

firebase-functions:
^6.0.0

firebase-tools:

13.17.0

firebase-admin:

[REQUIRED] Test case

all my cloud functions were setup to run in region region("europe-west1")

I did a firebase deploy --only functions and saw the prompt to npm install --save firebase-functions@latest

I then redeployed my cloud functions and got errors in two cloud functions stating that:

error TS2339: Property 'region' does not exist on type 'typeof import("/home/user/development/app/functions/node_modules/firebase-functions/lib/v2/index")'

[REQUIRED] Steps to reproduce

// This function will be triggered when a user is deleted
// It will delete the user document from the database and all relationships where the user is following others
import {UserRecord} from "firebase-admin/auth";
import {getFirestore} from "firebase-admin/firestore";
import * as functions from "firebase-functions";
import * as logger from "firebase-functions/logger";

export const deleteUserDocument = functions
  .region("europe-west1")
  .auth.user()
  .onDelete(async (user: UserRecord) => {
    const db = getFirestore();
    const userRef = db.collection("users").doc(user.uid);

    try {...}

[REQUIRED] Expected behavior

It should deploy in the same way as previously

[REQUIRED] Actual behavior

error on deployment

Were you able to successfully deploy your functions?

not since upgrading to 6.0.0

@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@davie-robertson
Copy link
Author

I just went through the recent code changes to the repo and saw that the default has changed.

So updating my imports to import * as functions from "firebase-functions/v1"; // Updated import fixed the issue.

Has this been documented anywhere?

Are we now able to use auth with v2 functions?

@davie-robertson
Copy link
Author

davie-robertson commented Sep 17, 2024

where is the changelog mentioned in #1606
This contains the breaking code warning

@sk8killer
Copy link

import functions from 'firebase-functions'
to -->
import functions from 'firebase-functions/v1'

Did the trick for me.

@slk333
Copy link

slk333 commented Nov 9, 2024

import functions from 'firebase-functions' to --> import functions from 'firebase-functions/v1'

Did the trick for me.

this should have been mentioned in the changelog

@tomchify
Copy link

tomchify commented Nov 16, 2024

For others who land here from search, I had a similar error when trying to deploy cloud functions:

firebase cloud functions Property 'runWith' does not exist on type 'typeof...

The import from /v1 change described above helped, but I also had to downgrade firebase-functions to 5.0 from 6.0:
yarn add firebase-functions@^5.0.1
The error occurred with version ^6.0 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

5 participants