Skip to content
Devesh edited this page Jan 6, 2023 · 3 revisions

How to Enable Cookies in Apollo Studio?

To enable cookies in Apollo Studio, turn on “Include Cookies” and add a new shared header with a header key as x-forwarded-proto and the header value as https.

The settings panel for Apollo Studio should look like the following:

195164865-a46dbed1-364d-4879-981e-0871bc1b45f6

Why I cannot see my console logs or error logs properly?

Whenever adding a new query or mutation to the server, make sure to put that entire code block inside a try...catch statement. We need to do this because all our queries and mutations are going through a middleware so whenever an error occurs, it won't be directly logged into the console.

The try...catch statement can look something like this:

try {
  // Our Query or Mutation code block goes here
} catch (error) {
  console.error(error);
}

Why is the Login and Logout mutation not working?

The most probable reason that this could be happening is the cookies are not working. Make sure that the cookies are enabled and working properly.

Another reason could be that the Redis is either not installed or the Redis service is not up and running on your machine.

Redis is available only for Linux and Mac so if you are using Windows then a Native port of Redis for Windows is available here. This is more than sufficient to run this project on any Windows machine.

After you enable cookies, you should be able to Login and Logout using Apollo Server like the following:

brave_1K6bHkduHi

The name of the cookie that is saved in the browser by our backend is obfc. Apollo Server saves a lot of different cookies in the browser for it to function properly. Therefore to filer out our cookie, we need to put obfc in the search field.

Why cannot I access the req object in my newly written Queries or Mutations?

If the req object is not accessible, then it could be because req is not destructured from the parameters of the query or mutation function. It should look like the following:

    myQueryOrMutationFunction: async (_, { myFunctionInput }, { req }) => {

What is the Tech Stack that is being used on the backend? (for beginners)

  • Express - Express is the Node.js web application framework that our backend is running on.
  • Apollo Server - Apollo Server is the GraphQL server that we will use to build our GraphQL API. We will use Apollo Server's Apollo Studio which will provide us with a lot of helpful features during development.
  • MongoDB - MongoDB is the database that we are using to store all the data for the Journal Policy Tracker App. MongoDB is an application that we need to install on our machine before we can use it. After installation, we will be able to save data in the database.
  • Mongoose - Mongoose is a JavaScript package that lets our backend communicate with the MongoDB database more effectively and efficiently that is running on our machine. That is why we do not write any MongoDB logic directly. All the logic for communicating with our database is written using Mongoose.
  • Babel - With the help of Babel, we can write modern JavaScript which can then later be converted to an older version.
  • GitHub Actions - GitHub Actions lets us automate the deployment of the latest code as soon as any Pull Request gets merged.
  • DigitalOcean - Digital Ocean is where we will be hosting our web app.