parse-community / parse-community/parse-server
Inconsistent config validation when starting a server instance via CLI vs. API
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- [X ] I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
When starting a Parse Server instance via CLI, all config parameters are extensively checked and warnings/errors are logged if any issues are found (see Definitions.js). These same checks are not performed when creating a server instance via API.
This can lead to situations where a server setup is created and tested via API that later fails when started via CLI.
Ideally the same checks are performed when starting via API and CLI, so possible configuration issues can be detected early on and are consistent independent of how the server is started.
As there might be non-CLI installations that wouldn't pass the existing CLI checks, this should at least initially be an optional feature.
Steps to reproduce
On 5.5.1, the following config can be used to reproduce:
{
"appName": "test",
"appId": "test",
"masterKey": "test",
"logLevel": "error",
"auth": {
"facebook": {
"appIds": "test"
}
}
}
Passing this as config.json on the CLI results in an error (on v5.3 - v5.5.1).
Starting via API works:
const express = require('express');
const ParseServer = require('parse-server').ParseServer;
const fs = require('fs');
let api = new ParseServer(JSON.parse(fs.readFileSync('config.json')));
let app = express();
app.use('/parse', api);
app.listen(1337, () => console.log('parse-server running on port 1337.'));
Actual Outcome
The CLI gave following error (meanwhile addressed: https://github.com/parse-community/parse-server/pull/8666)
Error: [object Object] should be a comma separated string or an array
Expected Outcome
I expected the server to run fine when started via CLI instead of API (as it did before).
Environment
Server
- Parse Server version: all (tested with 5.5.1)
- Operating system: macOS, linux
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): localhost
Database
- System (MongoDB or Postgres): n/a
- Database version: n/a
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): n/a
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc): n/a
- SDK version: n/a
Logs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/Options/Definitions.js and the CLI startup path, then compare them with the ParseServer API constructor shown in the reproduction. Run the supplied configuration through both entry points, noting the validation and logging differences. Done means the validation behavior is consistent when the optional feature is enabled, without breaking non-CLI installations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, javascript, node.js
- Domain
- api, backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100