graphql-playground: request.credentials configuration is ignored

This issue pertains to the following package(s):

  • GraphQL Playground - Electron App
  • GraphQL Playground HTML
  • GraphQL Playground
  • GraphQL Playground Express Middleware
  • GraphQL Playground Hapi Middleware
  • GraphQL Playground Koa Middleware
  • GraphQL Playground Lambda Middleware

Setup:

app.use('/', expressPlayground({
  endpoint: '/',
  settings: {
    'request.credentials': 'include'
  }
}));

The generated code confirms that the option is being passed:

GraphQLPlayground.init(root, {
  "endpoint": "/",
  "settings": {
    "request.credentials": "include"
  },
  "version": "1.7.2",
  "canSaveConfig": false
})

However, viewing the configuration in the application (browser) shows that the setting did not have effect:

{
  "general.betaUpdates": false,
  "editor.cursorShape": "line",
  "editor.fontSize": 14,
  "editor.fontFamily": "'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace",
  "editor.theme": "dark",
  "editor.reuseHeaders": true,
  "prettier.printWidth": 80,
  "request.credentials": "omit",
  "tracing.hideTracingResponse": true
}

I have tried reseting the local storage values with no effect.

Changing the configuration using the application itself makes it work as expected for that local session.

The issue appears to be that GraphQLPlayground.init ignores request.credentials setting.

Related issues:

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 24
  • Comments: 20 (6 by maintainers)

Most upvoted comments

Why is the default setting omit?!

I’m still running into the very same issue and it seems this was only fixed for graphql-playground-react, while graphql-playground-html has the same issue.

Running this via apollo-server-koa @ 2.1.0, which requires @apollographql/graphql-playground-html @ ^1.6.0, which resolves to 1.6.4 and I’m seeing the exact same behavior of ignored settings.

Would appreciate some help here. If you need any more pointers please let me know 🙏

The server should just be able to push defaults over the defined defaults, which should then be overrideable by the settings screen in localStorage.

So if I define serverside that const defaults = {a: 1, b: 2}; and Playground prescribes global defaults {a: 3, c: 2} the UI should show {a: 3, b: 2, c: 2} and allow the end user to override any of them locally.

It would also in this case be nice if there was a “Reset to defaults” button in the UI which deleted any local overrides and fall back to Playground defaults + server defined defaults.

I ran into this with the koa playground. One twist: if I set "editor.fontSize": 10 on the server side, it is clearly affecting the UI, as the font is visibly smaller, but looking at the settings on the client still specifies the font as being "editor.fontSize": 14. So there might be a mix of “the setting is not sent to the client” as well as “the client is not displaying the applied settings”.