Skip to content

Inconsistent config validation when starting a server instance via CLI vs. API #8673

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

Open
3 tasks done
FransGH opened this issue Jun 28, 2023 · 6 comments
Open
3 tasks done
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@FransGH
Copy link
Contributor

FransGH commented Jun 28, 2023

New Issue Checklist

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: #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

@parse-github-assistant
Copy link

parse-github-assistant bot commented Jun 28, 2023

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.

@mtrezza mtrezza changed the title Feature: apply the same configuration check when starting a server instance via CLI and API Inconsistent config validation when starting a server instance via CLI vs. API Jun 28, 2023
@evtimmy
Copy link

evtimmy commented Jul 5, 2024

Just stumbled upon this trying to configure 'auth' option in config.json, server starting from CLI (default docker image).
This breaks 'auth' option for CLI server.
Any work-arounds?

@mtrezza
Copy link
Member

mtrezza commented Jul 6, 2024

Does this still occur with the latest alpha version of Parse Server?

@evtimmy
Copy link

evtimmy commented Jul 7, 2024

I see 'auth' issue is fixed in 5.5.3, here https://github.com/parse-community/parse-server/pull/8669/files thanks!

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Jul 8, 2024
@mtrezza mtrezza closed this as completed Jul 8, 2024
@mtrezza mtrezza added the state:duplicate Duplicate of already reported issue label Jul 8, 2024
@evtimmy
Copy link

evtimmy commented Jul 8, 2024

Is the configuration options validation that is performed on starting the server via CLI also performed when starting the server via API and if so, which parse-server version fixed that?

@mtrezza
Copy link
Member

mtrezza commented Jul 8, 2024

I assumed from your comment that the issue has been fixed; I'll re-open.

@mtrezza mtrezza reopened this Jul 8, 2024
@mtrezza mtrezza removed the state:duplicate Duplicate of already reported issue label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

3 participants