Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions packages/apollo/src/load-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,15 @@ export async function loadSchema(
config: ApolloConfig
): Promise<GraphQLSchema | undefined> {
if (dependency.schema) {
try {
return await fetchSchema(
{ url: dependency.schema },
config.projectFolder
);
} catch {}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Throwing away all errors which occur from the fetchSchema method buries not only just the mere failure to acquire the schema in some manner, but it also neglects to reveal very important information about HTTP transport errors, file system errors, GraphQL execution and more — all of which happen via fetchSchema!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Faced this yesterday, because of this catch - SSL certificate error was swallowed.

return await fetchSchema({ url: dependency.schema }, config.projectFolder);
} else if (dependency.endpoint && dependency.endpoint.url) {
return await fetchSchema(dependency.endpoint, config.projectFolder);
} else if (dependency.engineKey) {
return await fetchSchemaFromEngine(
dependency.engineKey,
config.engineEndpoint
);
} else {
return undefined;
}

if (dependency.endpoint && dependency.endpoint.url) {
try {
return await fetchSchema(dependency.endpoint, config.projectFolder);
} catch {}
}

if (dependency.engineKey) {
try {
return await fetchSchemaFromEngine(
dependency.engineKey,
config.engineEndpoint
);
} catch {}
}

return undefined;
}