Voyage II: Federating the Monolith: issues with introspection in Apollo Studio

Hi Apollo!

I am having issues with the Federating the monolith course. As I’ve gotten deeper into the modules, I am getting errors on http://localhost:4000/ in Apollo Studio and cannot run queries even after setting up a Bearer user 1 auth token. here is the error I am seeing. I did try to run npm start from the final directory as well, as I thought perhaps I made a mistake in my own code, but I am getting the same error using the final project code. Any help would be greatly appreciates as not being able to run the queries in Studio, is making this a bit hard to understand all that I am learning. Thank you!

{
  "errors": [
    {
      "message": "Context creation failed: connect ECONNREFUSED 127.0.0.1:4011",
      "extensions": {
        "code": "UNAUTHENTICATED",
        "exception": {
          "stacktrace": [
            "AuthenticationError: Context creation failed: connect ECONNREFUSED 127.0.0.1:4011",
            "    at /Users/jvajda/Documents/Github/apollo-graphql-tutorials/odyssey-voyage-II-server/final/index.js:35:17",
            "    at processTicksAndRejections (node:internal/process/task_queues:96:5)",
            "    at async ApolloServer.context (/Users/jvajda/Documents/Github/apollo-graphql-tutorials/odyssey-voyage-II-server/final/index.js:32:24)",
            "    at async ApolloServer.graphQLServerOptions (/Users/jvajda/Documents/Github/apollo-graphql-tutorials/odyssey-voyage-II-server/node_modules/apollo-server-core/dist/ApolloServer.js:492:23)",
            "    at async resolveGraphqlOptions (/Users/jvajda/Documents/Github/apollo-graphql-tutorials/odyssey-voyage-II-server/node_modules/apollo-server-core/dist/graphqlOptions.js:6:16)",
            "    at async runHttpQuery (/Users/jvajda/Documents/Github/apollo-graphql-tutorials/odyssey-voyage-II-server/node_modules/apollo-server-core/dist/runHttpQuery.js:54:19)"
          ]
        }
      }
    }
  ]
}

Hey @jpvajda , thanks for reaching out! It looks like the server is trying to reach the localhost:4011 endpoint, which is where the Accounts API is located. Can you first try to run npm run launch so that all services are running?

1 Like

@MichelleMabuyo Thank you for the assistance! :pray: I went ahead and ran that command, but now I’m getting an error on port 4001.

  • I did run this command lsof -i tcp:4001 in case the port was already in us, and re-ran npm run launch
  • I am also using Bearer user-1 as the auth token.
  • This is occurring on the interface and fragments test query

Error

{
  "errors": [
    {
      "message": "request to http://localhost:4001/ failed, reason: connect ECONNREFUSED 127.0.0.1:4001",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "FetchError: request to http://localhost:4001/ failed, reason: connect ECONNREFUSED 127.0.0.1:4001",
            "    at ClientRequest.<anonymous> (/Users/jvajda/Documents/Github/apollo-graphql-tutorials/odyssey-voyage-II-server/node_modules/minipass-fetch/lib/index.js:110:14)",
            "    at ClientRequest.emit (node:events:526:28)",
            "    at Socket.socketErrorListener (node:_http_client:442:9)",
            "    at Socket.emit (node:events:538:35)",
            "    at emitErrorNT (node:internal/streams/destroy:157:8)",
            "    at emitErrorCloseNT (node:internal/streams/destroy:122:3)",
            "    at processTicksAndRejections (node:internal/process/task_queues:83:21)"
          ]
        }
      }
    }
  ],
  "data": null
}

Alright awesome @jpvajda , that looks like a new error where the server in port 4001 is not running! That server is for the monolith subgraph which is run using npm run start:monolith-subgraph. Can you give that a try in a new terminal window?

I realize this is a lot of services and servers to keep track of, we will look into ways to improve our explanations or architecture!

1 Like

@MichelleMabuyo That did the trick! Thank you! And in case anyone else faces this problem, I wrote the steps down. Not sure if order matters, but this sequence made sense in head. :sunglasses:

In 3 different terminals from the project root directory

to start the monolith subgraph on port 4001

  1. npm run start:monolith-subgraph

to start all services on port 4010 and 4011

  1. npm run launch

to to start the server on port 4000

  1. npm start
1 Like

Perfect, great to hear it! Looks like adding something like a Quickstart section similar to that list would work to make sure all the right things are running :slight_smile: Let us know if you run into any other issues!

1 Like