Impossible to generate MFA with parse-dashboard --createMFA (parse dashboard 7.1.0)
New Issue Checklist
- [X] I am not disclosing a vulnerability.
- [X] I am not just asking a question.
- [X] I have searched through existing issues.
- [X] I can reproduce the issue with the latest versions of Parse Server and Parse Dashboard.
Issue Description
When running the command parse-dashboard --createMFA I obtain an error about inquirer package.
I'm using Node 22 and latest parse dashboard.
$ ./node_modules/parse-dashboard/bin/parse-dashboard --createMFA
/home/node/app/node_modules/parse-dashboard/Parse-Dashboard/CLI/mfa.js:211
const { username, app } = await inquirer.prompt([
^
TypeError: inquirer.prompt is not a function
at createMFA (/home/node/app/node_modules/parse-dashboard/Parse-Dashboard/CLI/mfa.js:211:46)
at Command.<anonymous> (/home/node/app/node_modules/parse-dashboard/Parse-Dashboard/index.js:38:13)
at Command.listener [as _actionHandler] (/home/node/app/node_modules/commander/lib/command.js:482:17)
at /home/node/app/node_modules/commander/lib/command.js:1265:65
at Command._chainOrCall (/home/node/app/node_modules/commander/lib/command.js:1159:12)
at Command._parseCommand (/home/node/app/node_modules/commander/lib/command.js:1265:27)
at Command.parseAsync (/home/node/app/node_modules/commander/lib/command.js:917:16)
at run (/home/node/app/node_modules/parse-dashboard/Parse-Dashboard/index.js:45:17)
at Object.<anonymous> (/home/node/app/node_modules/parse-dashboard/Parse-Dashboard/index.js:51:1)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
Steps to reproduce
Run the command
Actual Outcome
The error described
Expected Outcome
Working procedure to create MFA key
Environment
Current dependencies (Node 22):
$ npm ls inquirer
[email protected] /home/node/app
`-- [email protected]
`-- [email protected]
🚀 Thanks for opening this issue!
ℹ️ You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
For now i'm ovverriding it in the package.json
"overrides": {
"parse-dashboard": {
"inquirer": "8.2.4"
}
},
Probably the fix is changing the way inquirer is imported.
Interesting find, would you want to try and open a PR, so we can see whether that fixes the issue?
References: https://github.com/SBoudrias/Inquirer.js/releases/tag/inquirer%409.0.0
Inquirer is now a native Node ECMAScript module. This will require your Node runtime to support es modules, and your app to be an es module. Node documentation over here: https://nodejs.org/api/esm.html#modules-ecmascript-modules
If you cannot migrate, please remember you can keep using the v8.x release line until you're ready.
I don't have time to test it, but the quicker fix is to lock the inquirer version (eg. "inquirer": "8.2.4") so when installing the dependencies the override won't be needed (tested working).
A possible fix (to be tested) could be also to try import the module using const inquirer = require('inquirer').default; in the Parse-Dashboard/CLI/mfa.js file.
Since inquirer is used only for CLI utils, not a core module, using an older version is not problem and the first proposal could be the way to go.