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.1 functions.runWith is not a function #1616

Open
joalzamora opened this issue Sep 17, 2024 · 2 comments
Open

6.0.1 functions.runWith is not a function #1616

joalzamora opened this issue Sep 17, 2024 · 2 comments

Comments

@joalzamora
Copy link

Related issues

[REQUIRED] Version info

upgrade from ^5.1.1 to ^6.0.1

node:

20

firebase-functions:
^6.0.1

firebase-tools:
13.15.2

13.5.2

firebase-admin:
^11.8.0

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

Execute the following command npm install --save firebase-functions@latest

and when I run the code I get the following error

TypeError: functions.runWith is not a function

A sample code is:

const functions = require('firebase-functions');

exports.newAccount = functions
.runWith({
memory: '256MB',
maxInstances: 1,
})
.auth.user().onCreate(async (user) => {
const email = user.email;
const subject = "Welcome"

    try {
        console.log("A new user account has been created")
    	await sendWelcome(email,subject);
    } catch (error) {
    	console.error('Error sending email:', error.message);
    }

});

[REQUIRED] Expected behavior

[REQUIRED] Actual behavior

TypeError: functions.runWith is not a function

Were you able to successfully deploy your functions?

@google-oss-bot
Copy link
Collaborator

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 have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

@davie-robertson
Copy link

davie-robertson commented Sep 17, 2024

There has been (what I consider to be an undocumented) breaking change in firebase-functions.

You now need to specify V1 on your import const functions = require('firebase-functions/v1');

see #1614

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