firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

6.0.1 functions.runWith is not a function

Open joalzamora opened this issue 1 year ago • 6 comments

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?

joalzamora avatar Sep 17 '24 01:09 joalzamora