Skip to content

Commit 6b3231b

Browse files
Add service:push debuggability (#1244)
Leverage oclif debug logger to add visibility into variables sent to Engine during service:push.
1 parent 3419b4a commit 6b3231b

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Upcoming
44

55
- `apollo`
6-
- <First `apollo` related entry goes here>
6+
- Add service:push debuggability [#1244](https://github.com/apollographql/apollo-tooling/pull/1244)
77
- `apollo-codegen-core`
88
- <First `apollo-codegen-core` related entry goes here>
99
- `apollo-codegen-flow`

packages/apollo/src/commands/service/push.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { flags } from "@oclif/command";
22
import { table } from "heroku-cli-util";
3-
import { introspectionFromSchema } from "graphql";
4-
3+
import { introspectionFromSchema, printSchema } from "graphql";
54
import { gitInfo } from "../../git";
65
import { ProjectCommand } from "../../Command";
6+
import { UploadSchemaVariables } from "apollo-language-server/lib/graphqlTypes";
77

88
export default class ServicePush extends ProjectCommand {
99
static aliases = ["schema:publish"];
@@ -35,21 +35,30 @@ export default class ServicePush extends ProjectCommand {
3535
const schema = await project.resolveSchema({ tag: flags.tag });
3636
gitContext = await gitInfo(this.log);
3737

38-
const { tag, code } = await project.engine.uploadSchema({
38+
const variables: UploadSchemaVariables = {
3939
id: config.name,
4040
// @ts-ignore
4141
// XXX Looks like TS should be generating ReadonlyArrays instead
4242
schema: introspectionFromSchema(schema).__schema,
4343
tag: flags.tag,
4444
gitContext
45-
});
46-
47-
result = {
48-
service: config.name,
49-
hash: tag.schema.hash,
50-
tag: tag.tag,
51-
code
5245
};
46+
47+
const response = await project.engine.uploadSchema(variables);
48+
if (response) {
49+
result = {
50+
service: config.name,
51+
hash: response.tag ? response.tag.schema.hash : null,
52+
tag: response.tag ? response.tag.tag : null,
53+
code: response.code
54+
};
55+
}
56+
57+
const { schema: _, ...restVariables } = variables;
58+
this.debug("Variables sent to Engine:");
59+
this.debug(restVariables);
60+
this.debug("SDL of introspection sent to Engine:");
61+
this.debug(printSchema(schema));
5362
}
5463
}
5564
]);

0 commit comments

Comments
 (0)