firebase / functions-samples

Collection of sample apps showcasing popular use cases using Cloud Functions for Firebase
https://firebase.google.com/docs/functions
Apache License 2.0
12.06k stars 3.84k forks source link

[BUG] in sample: delete-unused-accounts-cron TypeError: PromisePool is not a constructor #956

Open pavlik-code opened 2 years ago

pavlik-code commented 2 years ago

Which sample has a bug?

delete-unused-accounts-cron

How to reproduce the issue

I've deployed the sample function exactly per instructions in readme, however, the function fails in firebase and the logs returns:

accountcleanup TypeError: PromisePool is not a constructor

here is the line (33) of code that triggers the issue:

const promisePool = new PromisePool(() => deleteInactiveUser(inactiveUsers), MAX_CONCURRENT);

pavlik-code commented 2 years ago

Update: the issue was resolved by dropping .default in 21

old: const PromisePool = require('es6-promise-pool').default;

new: const PromisePool = require('es6-promise-pool');