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

fix broken graphql after /reload #73

Merged
merged 2 commits into from
Apr 14, 2020
Merged

Conversation

jmelis
Copy link
Contributor

@jmelis jmelis commented Apr 14, 2020

After upgrading the apollo-server-express version, any queries that include
interfaces will fail after reloading the server.

In order to reproduce we can just make a query like this one:

{
  permissions_v1 (path:"<path>") {
    service
    ... on PermissionGithubOrgTeam_v1 {
      org
    }
  }
}

Before reloading the object will contain org, but once we reload the
org parameter will be missing from the response.

This is because with the new apollo-server-express version besides
resetting the schema on a hot reload, we also need to make sure the
schemaDerivedData is also generated.

The solution to this issue was found here:
apollographql/apollo-server#1275 (comment)

Note the @ts-ignore line, which is needed because we are accessing a
private method generateSchemaDerivedData. Unless we have this line
typescript will raise an error when compiling.

This PR also adds a test that will catch this if there is a regression.

jmelis added 2 commits April 14, 2020 13:37
After upgrading the apollo-server-express version, any queries that
include interfaces will fail after reloading the server.

In order to reproduce we can just make a query like this one:

```
{
  permissions_v1 (path:"<path>") {
    service
    ... on PermissionGithubOrgTeam_v1 {
      org
    }
  }
}
```

Before reloading the object will contain `org`, but once we reload the
`org` parameter will be missing from the response.

This is because with the new apollo-server-express version besides
resetting the schema on a hot reload, we also need to make sure the
`schemaDerivedData` is also generated.

The solution to this issue was found here:
apollographql/apollo-server#1275 (comment)

Note the `@ts-ignore` line, which is needed because we are accessing a
private method `generateSchemaDerivedData`. Unless we have this line
typescript will raise an error when compiling.

This PR also adds a test that will catch this if there is a regression.
@jmelis
Copy link
Contributor Author

jmelis commented Apr 14, 2020

cc @rrati @tparikh

@jmelis jmelis merged commit 150f8e0 into app-sre:master Apr 14, 2020
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.

1 participant