Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AS3: Remove API key parser #5157

Closed
glasser opened this issue May 2, 2021 · 2 comments
Closed

AS3: Remove API key parser #5157

glasser opened this issue May 2, 2021 · 2 comments

Comments

@glasser
Copy link
Member

glasser commented May 2, 2021

Currently we parse a graph ID out of APOLLO_KEY if you don't set APOLLO_GRAPH_ID (or the equivalent constructor argument). This is awkward for a bunch of reasons. We should start encouraging people to set APOLLO_GRAPH_ID now, and require it in AS3 if you set APOLLO_KEY.

@glasser
Copy link
Member Author

glasser commented May 19, 2021

We will also migrate towards a graph-ref-centric world.

glasser added a commit that referenced this issue May 19, 2021
glasser added a commit to apollographql/apollo that referenced this issue May 19, 2021
glasser added a commit that referenced this issue May 20, 2021
glasser added a commit to apollographql/apollo that referenced this issue May 20, 2021
glasser added a commit that referenced this issue May 26, 2021
Apollo Server shouldn't need to have deep knowledge of Apollo Studio's
data model. "ID and variant" are overly precise. This PR moves us
towards a world where Apollo Server only needs to be aware of the "graph
ref", a string like `id@variant` (but which might end up with other
spellings later).

We intend to remove the API key parser in Apollo Server 3 and stop
providing `graphId`/`graphVariant` to plugins and the gateway, but these
remain for now.

This PR:
- Allows you to specify the graph ref via `APOLLO_GRAPH_REF` or `apollo:
  {graphRef}`. It is an error to also specify ID or variant if you
  specify the ref.
- Makes `graphRef` available to plugins and the gateway alongside
  `graphId` and `graphRef`.
- If you specify an API key but it does not start with `service:` and
  you do not specify graph ref or graph ID, it throws an error. This
  fixes #4640. Note that while there are other legal Apollo key formats,
  Apollo Server only currently works with `service:*` keys.
- Switches usage reporting and schema reporting to use new protocols
  that specify the graph ref instead of the variant, and to print Studio
  URLs that use the graph ref instead of the ID and variant separately.
  (The old protocols didn't specify the ID because it was implied by the
  API key.)
- The schema reporter previously used Apollo Codegen without any
  documentation of how it worked. Set up graphql-code-generator instead
  and add an npm script to regenerate the types.

Part of #5157.
glasser added a commit that referenced this issue May 26, 2021
Apollo Server shouldn't need to have deep knowledge of Apollo Studio's
data model. "ID and variant" are overly precise. This PR moves us
towards a world where Apollo Server only needs to be aware of the "graph
ref", a string like `id@variant` (but which might end up with other
spellings later).

We intend to remove the API key parser in Apollo Server 3 and stop
providing `graphId`/`graphVariant` to plugins and the gateway, but these
remain for now.

This PR:
- Allows you to specify the graph ref via `APOLLO_GRAPH_REF` or `apollo:
  {graphRef}`. It is an error to also specify ID or variant if you
  specify the ref.
- Makes `graphRef` available to plugins and the gateway alongside
  `graphId` and `graphRef`.
- If you specify an API key but it does not start with `service:` and
  you do not specify graph ref or graph ID, it throws an error. This
  fixes #4640. Note that while there are other legal Apollo key formats,
  Apollo Server only currently works with `service:*` keys.
- If you specify an API key but don't specify a graph ref or ID, prints a deprecation
  warning telling you to set a graph ref.
- Switches usage reporting and schema reporting to use new protocols
  that specify the graph ref instead of the variant, and to print Studio
  URLs that use the graph ref instead of the ID and variant separately.
  (The old protocols didn't specify the ID because it was implied by the
  API key.)
- The schema reporter previously used Apollo Codegen without any
  documentation of how it worked. Set up graphql-code-generator instead
  and add an npm script to regenerate the types.

Part of #5157.
glasser added a commit that referenced this issue May 26, 2021
Apollo Server shouldn't need to have deep knowledge of Apollo Studio's
data model. "ID and variant" are overly precise. This PR moves us
towards a world where Apollo Server only needs to be aware of the "graph
ref", a string like `id@variant` (but which might end up with other
spellings later).

We intend to remove the API key parser in Apollo Server 3 and stop
providing `graphId`/`graphVariant` to plugins and the gateway, but these
remain for now.

This PR:
- Allows you to specify the graph ref via `APOLLO_GRAPH_REF` or `apollo:
  {graphRef}`. It is an error to also specify ID or variant if you
  specify the ref.
- Makes `graphRef` available to plugins and the gateway alongside
  `graphId` and `graphRef`.
- If you specify an API key but it does not start with `service:` and
  you do not specify graph ref or graph ID, it throws an error. This
  fixes #4640. Note that while there are other legal Apollo key formats,
  Apollo Server only currently works with `service:*` keys.
- If you specify an API key but don't specify a graph ref or ID, prints a deprecation
  warning telling you to set a graph ref.
- Switches usage reporting and schema reporting to use new protocols
  that specify the graph ref instead of the variant, and to print Studio
  URLs that use the graph ref instead of the ID and variant separately.
  (The old protocols didn't specify the ID because it was implied by the
  API key.)
- The schema reporter previously used Apollo Codegen without any
  documentation of how it worked. Set up graphql-code-generator instead
  and add an npm script to regenerate the types.

Part of #5157.
@glasser
Copy link
Member Author

glasser commented May 28, 2021

Fixed on release-3.0 after merging #5241 to it.

@glasser glasser closed this as completed May 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant