6. Debugging Connectors
4m

(Text covers the exact same content as the video)

Lesson tasks

Practice

What happens when you include a field in the selection that is NOT defined in the schema? (For example, try adding latitude to the selection.)
Which tab in the Connectors Debugger panel shows you errors if there are discrepancies in your selection and your schema?

Use the JSON response and schema below to answer the next question.

REST API response
{
"id": "product-xyz"
"description": "A high-quality replica of a space helmet used by astronauts."
}
Schema
type Query {
randomProduct: Product
@connect(
source: "ecomm"
http: { baseURL: "/random" }
selection: """
# TODO
"""
)
}
type Product {
"The at-a-glance description for a product"
tagline: String!
}
Given the JSON response and the schema above, which of the following selection mappings would result in no mapping errors?

Key takeaways

  • To troubleshoot why our are not populating the right values from the REST API, we can use the Connectors Debugger. This tool lets us take a deeper look at each network call to see where any errors might have occurred.
  • When there's a name mismatch between our name and JSON property, we can use the selection parameter to map them manually. To do this, we use the syntax fieldName: jsonName.

Up next

Let's continue to put this process into practice throughout the course as we sprinkle in some new concepts along the way.

Next

Share your questions and comments about this lesson

Your feedback helps us improve! If you're stuck or confused, let us know and we'll help you out. All comments are public and must follow the Apollo Code of Conduct. Note that comments that have been resolved or addressed may be removed.

You'll need a GitHub account to post below. Don't have one? Post in our Odyssey forum instead.