Skip to content

Removing a ParseGraphQLConfiguration does cause server to return to default settings #6941

Closed
parse-community/docs
#772
@185driver

Description

@185driver

New Issue Checklist

Issue Description

If a change is made to a ParseGraphQLConfiguration using setGraphQLConfig(), and then the change is removed, the original (default) ParseGraphQLConfiguration does not return automatically. It must be reset by the developer.

Steps to reproduce

  1. Create a Parse Server instance and add a custom graphQLConfig similar to the example below.
  2. Note that the GraphQL Playground Docs tab shows that the get and find query aliases for the Item class are in use.
  3. Remove the custom graphQLConfig related code from the Parse Server instance and refresh the GraphQL Playground page.
  4. Note that the GraphQL Playground Docs tab continues to show that the get and find query aliases for the Item class are in use.
  5. Instead of removing the graphQLConfig related code as mentioned in step #3, change it to this (forces a reset of the previously-changed configuration settings):
const graphQLConfig = {
  classConfigs: [],
};
  1. Note that the GraphQL Playground Docs tab now show that the get and find queries for the Item class has returned to the default item and items query names, respectively.

Parse Server Instance Example:

const parseServer = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/test',
  appId: 'APPLICATION_ID',
  masterKey: 'MASTER_KEY',
  serverURL: 'http://localhost:1337/parse',
});

const parseGraphQLServer = new ParseGraphQLServer(
  parseServer,
  {
    graphQLPath: '/graphql',
    playgroundPath: '/playground'
  },
);

const graphQLConfig = {
  classConfigs: [
    {
      className: 'Item',
      query: {
        getAlias: 'getItem',
        findAlias: 'findItems',
      },
    },
  ],
};

const setParseGraphQLConfig = async () => {
  await parseGraphQLServer.setGraphQLConfig(graphQLConfig);
};

setParseGraphQLConfig();

app.use('/parse', parseServer.app);
parseGraphQLServer.applyGraphQL(app);

Actual Outcome

The graphQLConfig settings do not automatically return to their default settings after removing custom changes.

Expected Outcome

The graphQLConfig settings should revert to their default settings automatically if no custom changes are applied.

Environment

Server

  • Parse Server version: 4.3.0
  • Operating system: Windows 10
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): localhost

Database

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

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): GraphQL
  • SDK version: N/A

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:docsOnly change in the docs or README

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions