Skip to content

Conversation

Hunter-apollo
Copy link

Updates error code documentation for new $batch error codes.

Also adds links to a few error messages where it may be helpful.

@Hunter-apollo Hunter-apollo requested a review from a team as a code owner May 28, 2025 17:18
Copy link

changeset-bot bot commented May 28, 2025

⚠️ No Changeset found

Latest commit: b717d13

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Hunter-apollo Hunter-apollo changed the title Update Connectors error codes for 2.11 release. docs: Update connectors error codes May 28, 2025
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented May 28, 2025

⚠️ Docs preview not attached to branch

The preview was not built because the PR's base branch next is not in the list of sources.

An Apollo team member can comment one of the following commands to dictate which branch to attach the preview to:

  • !docs set-base-branch version-0.x
  • !docs set-base-branch main

Build ID: d22aac24f408c7c2d36d0617

Copy link

codesandbox-ci bot commented May 28, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@apollo-librarian
Copy link

apollo-librarian bot commented Jun 27, 2025

⚠️ Docs preview not attached to branch

The preview was not built because the PR's base branch next is not in the list of sources.

An Apollo team member can comment one of the following commands to dictate which branch to attach the preview to:

  • !docs set-base-branch version-0.x
  • !docs set-base-branch main

Build ID: 3b60e94479ab57519dfc9e78

@Hunter-apollo Hunter-apollo force-pushed the hunter/add-batch-error-codes branch from d535d07 to b717d13 Compare June 27, 2025 17:27
</td>
<td>

Using both [`$batch`](/graphos/connectors/mapping/variables#batch) and [`$this`](/graphos/connectors/mapping/variables#this) in a mapping is not allowed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Using both [`$batch`](/graphos/connectors/mapping/variables#batch) and [`$this`](/graphos/connectors/mapping/variables#this) in a mapping is not allowed.
Using both [`$batch`](/graphos/connectors/mapping/variables#batch) and [`$this`](/graphos/connectors/mapping/variables#this) in the same connector is not allowed.

<td>

A `@key` could not be resolved for the given combination of variables. In order to create a valid `@key`
selection's are expected contain at least one of the following variables: `$args`, `$this`, or `$batch`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
selection's are expected contain at least one of the following variables: `$args`, `$this`, or `$batch`.
selections are expected contain at least one of the following variables: `$args`, `$this`, or `$batch`.

Librarian is correct

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's totally unclear to me from reading the code how this actually happens 😅. Seems like the user actually only gets an error if they mention a field which doesn't exist... which also generates another duplicate error. But I don't think not mentioning any variables causes this? So maybe we should be getting rid of this error code long term.

It already exists in released routers now, though, so I guess we should leave it documented.

Comment on lines +131 to +132
Variables (such as `$this` or `$context`) to define Connector `$batch` selections.
Batch selections should be mapped from the `$batch` variable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't even know why we have this restriction—that doesn't seem like it should be required? But I think we should spell out the issue more clearly:

Suggested change
Variables (such as `$this` or `$context`) to define Connector `$batch` selections.
Batch selections should be mapped from the `$batch` variable.
The `selection` fields which match any used `$batch` fields must come from the API response, not from any other variables.

Can you also add a good/bad to https://www.apollographql.com/docs/graphos/connectors/requests/batching#rules-for-batch-connectors that we can link to here? Unless I'm misunderstanding the code—but again, I'm not sure why we added this restriction? What if the ID comes back in a header for some reason?

</td>
<td>

`@connect` cannot be applied to a query, mutation, or subscription root type
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`@connect` cannot be applied to a query, mutation, or subscription root type
`@connect` cannot be applied to a query, mutation, or subscription root type.

For librarian

<td>

The schema includes fields that aren't resolved by a connector.
The schema includes fields that aren't resolved by a [connector](/graphos/connectors).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The schema includes fields that aren't resolved by a [connector](/graphos/connectors).
When using [Connectors](/graphos/connectors) in a schema, every field must be resolvable by at least one Connector. To solve this problem, you will need to either add a `@connect` to the field in question, or add the field to the `selection` of an existing `@connect`.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you just added the link, but I figure we could explain the solution a bit while we're here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants