question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cookies are not being sent in Playground Express

See original GitHub issue

This issue pertains to the following package(s):

  • GraphQL Playground Express Middleware

What OS and OS version are you experiencing the issue(s) on?

Ubuntu 16.04.4 LTS xenial

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

1.7.0

What is the expected behavior?

It should send browser cookies along with the GraphQL request.

What is the actual behavior?

The cookies are absent in the request originating from Playground.

What steps may we take to reproduce the behavior?

You can reproduce it with a demo app on glitch

  1. Open the app to land at /, a cookie is set
  2. Navigate to /graphql and run a query { hello }
  3. Observe the browser console and/or glitch console

req

You can see that Cookie is missing from Request Headers even though it is set in the browser

cookie

The cookie is hence not sent over to express

log

Note that the demo app runs on Apollo Server v2 which uses apollo-server-express version 1.7.0 under the hood. I took the following screenshot from twitch terminal, inside node_modules

version

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:25
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

334reactions
vladanpaunoviccommented, Aug 13, 2018

Here is what I found as a workaround:

  1. Go to your GraphQl Playground

  2. In the top right corner click on the gear icon (settings)

  3. Change the following

{
-  "request.credentials": "omit",
+  "request.credentials": "same-origin",
}

Somehow, the client is not using the server settings, therefore it consumes request.credentials: "omit" instead of "same-origin"

19reactions
gustavlrsncommented, Jun 28, 2018

Also using playground behind Apollo Server and having the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow cookies to be sent alongside request - Apollo GraphQL
My editor and nodemon shows no errors. Everything works when I turn the Allow Cookies toggle off. Here is the express part of...
Read more >
Express-session does not set cookie? - node.js - Stack Overflow
My idea is that: GraphQL Playground is retired and ... cookies do not get transfered to this location but the cookie is set...
Read more >
How to set cookies with GraphQL - YouTube
Learn how to set cookies with GraphQL.Code: https://github.com/benawad/node-ts-graphql-boilerplate/tree/8_cookies_jwtLinks from ...
Read more >
CircuitPython Made Easy on Circuit Playground Express
All code that is indented under while True: is "inside" the loop. For the red LED, "on" and "off" are states referred to...
Read more >
The Circuit Playground | Code.org
The Circuit Playground is family of small microcontroller boards with LEDs, ... Playground, two are compatible with CS Discoveries and one of them...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found