Voyage II Fetch error from router

Hi–I’m going through the Voyage tutorials and I seem to be having some trouble with “Federating the Monolith”. I’m on part 5–“Configuring the router” and I keep getting this error in my console any time I try to make a query against the router:

2022-12-21T23:07:43.376931Z ERROR apollo_router::services::subgraph_service: fetch_error="hyper::Error(Connect, Custom { kind: Other, error: Custom { kind: InvalidData, error: CorruptMessage } })"
2022-12-21T23:07:43.377140Z ERROR apollo_router::query_planner::execution: Fetch error: HTTP fetch failed from 'monolith': HTTP fetch failed from 'monolith': error trying to connect: received corrupt message

Results in explorer:

Querying the monolith service directly at http://localhost:4001 works fine. I get the expected auth error there and non-authed queries return data as expected. (Apparently as a new user I can’t share two screenshots in my post :confused: )

I’ve tried re-setting up the project repo from scratch, and also tried running the version of the app in the final directory following the README instructions, but I get the same error there so I can’t figure out what’s going wrong. I found this (maybe?) similar issue mentioned in GitHub, but it looks like it was a CORS problem there, and I’m not sure that would be the issue here :thinking: show exact error when subgraphs files · Issue #1382 · apollographql/router · GitHub

Has anyone else run across this or could help me debug?

I’m on Node v. 16.13.2 and npm v. 8.1.2

Here’s the screenshot of the successful (or expected) response when querying the subgraph directly:

Hey @bjpennington ! Sorry to hear you’re running into issues, I hope we can troubleshoot this together!

I ran through those lessons again and was able to get the expected response back from the graph.

A couple things we can check:

  • Is the router config file set up to propagate headers?
  • Are all the necessary services and subgraphs running? (npm start and npm run launch in the monolith folder)

Would you be able to share a link to your code so far?

Hi @MichelleMabuyo Thanks for reaching out!

It’s been a couple weeks since I looked at this since I was busy with the holidays and got sick right after :stuck_out_tongue_closed_eyes: I decided to revisit the tutorial and start from scratch and this time I got past the point where I was stuck with no issues–no idea what was different this time!

BUT, I did run into what looks like the same or a similar problem a little further on in the tutorial. After moving over the query and mutation resolvers and publishing my subgraphs, I’m getting “received corrupt message” errors again when trying to query the “me” type:


(I’m also having issues with the “GetListing” query from the tutorial example, but I’m not 100% sure if that’s purely related to the “received corrupt message” errors or if I did in fact mess up something else in the implementation)

The router config file should be configured correctly I believe, and I should have all the things running (npm run launch from the monolith directory, npm start from the monolith directory, npm start from the subgraph-accounts directory, and the router running from the router directory)

I’ve pushed up the current state of my code here: GitHub - bjpennington/odyssey-voyage-II-server: Apollo Odyssey tutorial repo

If you’re able to point me towards anywhere I might have bungled things up, I’d appreciate it!

FWIW, I’m using:
node: v16.13.2
npm: v8.1.2
Firefox: v108.0.2 (64-bit)
MacOS: Ventura 13.1 (using an Apple M1)

Thanks again so much for taking the time to look into this (and for the work y’all are doing on these awesome tutorials!) :pray:

Ahhh I can totally relate, I went through the same thing over my holiday break! :melting_face: Hopefully you’re feeling better!!

Thank you for giving the tutorial another try! Really great information you’ve provided here. So I went ahead and cloned the repo, created a fresh graph, etc… and I’m still getting a successful response with the GetMyProfile query :sweat_smile:

SO I think this might point to something in the accounts service not running or installed correctly?

Let’s try:

  • Run npm run db:reset in the monolith folder to reset the services then npm run launch.
  • Double check the routing URL for accounts. Is it set to the correct port? You can find the routing URL under Schema → SDL, then click the accounts subgraph. While you’re there, can you check that the monolith URL is also set to the correct port?
  • Let’s try a query that only hits the monolith subgraph, like this one:
query GetAllAmenities {
  listingAmenities {
    category
    name
  }
}

If that query works, then something’s up with the accounts subgraph specifically!

@bjpennington If you’re still stuck, I’m happy to move this over to our Apollo Discord for some synchronous pair programming! We can share screens and everything and that might be easier :slight_smile: No pressure though, I’m still good to troubleshoot async here!

@MichelleMabuyo Ahhhh found the issue! Took a second to spot it, but when I checked the routing URL per your suggestion, I was using https instead of http for the accounts subgraph :woman_facepalming: I must have mistyped the url when publishing the accounts schema (and then of course I overlooked it since I didn’t include the url in my command when re-publishing the schema either). I’m sure I probably made the same mistake in my first attempt with the tutorial when publishing the monolith as a subgraph :see_no_evil:

At any rate, re-publishing the accounts schema with the updated http routing-url fixed it, and all my queries look like they’re working great now!

Thank you so much for your help with this!!

1 Like

Oooh good catch, that’s really subtle! Happy to help! :tada: