Merged in chore/replace-graphql-tag/loader (pull request #3096)
Use turbopack for dev builds. Remove graphql-tag/loader, replaced by gql`` tag literals instead. Approved-by: Linus Flood
This commit is contained in:
@@ -29,31 +29,6 @@ export async function request<T>(
|
||||
client.requestConfig.cache = params?.cache
|
||||
client.requestConfig.next = params?.next
|
||||
|
||||
if (env.PRINT_QUERY) {
|
||||
const print = (await import("graphql/language/printer")).print
|
||||
const rawResponse = await client.rawRequest<T>(
|
||||
print(query as DocumentNode),
|
||||
variables,
|
||||
{
|
||||
access_token: env.CMS_ACCESS_TOKEN,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* TODO: Send to Monitoring (Logging and Metrics)
|
||||
*/
|
||||
requestLogger.debug("complexity", {
|
||||
complexityLimit: rawResponse.headers.get("x-query-complexity"),
|
||||
referenceDepth: rawResponse.headers.get("x-reference-depth"),
|
||||
resolverCost: rawResponse.headers.get("x-resolver-cost"),
|
||||
})
|
||||
|
||||
return {
|
||||
data: rawResponse.data,
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// @ts-expect-error: query can be undefined (?)
|
||||
const operationName = (query as DocumentNode).definitions.find(
|
||||
@@ -140,6 +115,7 @@ export async function request<T>(
|
||||
`[gql] Error sending graphql request to ${env.CMS_URL}`,
|
||||
error
|
||||
)
|
||||
throw new Error("Something went wrong")
|
||||
|
||||
throw new Error("Failed to fetch data from CMS", { cause: { error } })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user