parse-community / parse-community/parse-server

Parse Server option cannot be set via environment for interfaces

Open
#7,151 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Issue Checklist
Issue Description

A Parse Server option cannot be set via environment variable if it is part of an interface. The reason seems to be that buildConfigDefinitions.js generates Definitions.js and adds the definitions for each interface into a separate module export. These definitions are then not part of module.exports.ParseServerOptions which seems to be the only export the Parse Server CLI considers.

Side note, that logic seems to be the reason why older Parse Server are all on the same root level and not grouped in nested objects, which is to consider for https://github.com/parse-community/parse-server/issues/7069.

Steps to reproduce

For example, idempotencyOptions has these sub keys:

idempotencyOptions: {
  paths: ...,
  ttl: ...,
}

The Definitions.js file only contains the root key PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS in module.exports.ParseServerOptions. The CLI runner only imports module.exports.ParseServerOptions therefore, setting environment variable PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_PATHS has no effect when initializing Parse Server.

Actual Outcome

All interfaces should be configurable via environment variables.

Expected Outcome

Only root key is configurable via environment variable.

Workaround

E.g. for idempotencyOptions the root key value can be set to an encoded object:

"PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS": "{\"paths\":[\"functions/.*\"]}",
Failing Test Case / Pull Request
  • 🤩 I submitted a PR with a fix and a test case.
  • 🧐 I submitted a PR with a failing test case.
Environment

Server

  • Parse Server version: 4.5.0
  • Operating system: irrelevant
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): irrelevant

Database

  • System (MongoDB or Postgres): irrelevant
  • Database version: irrelevant
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): irrelevant

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): irrelevant
  • SDK version: irrelevant
Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with buildConfigDefinitions.js and the generated Definitions.js, then trace which export the Parse Server CLI imports for environment configuration. Reproduce the idempotencyOptions example with PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_PATHS and inspect the existing configuration tests. Done means interface subkeys are recognized from environment variables while root options continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.