Bump Hive Gateway and no cross-origin credentials (#7305)

This commit is contained in:
Denis Badurina 2025-11-25 11:10:14 +01:00 committed by GitHub
parent 5fec03c297
commit eb700a1b50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 4559 additions and 151 deletions

View file

@ -2604,7 +2604,7 @@ dependencies = [
[[package]]
name = "hive-apollo-router-plugin"
version = "2.3.2"
version = "2.3.3"
dependencies = [
"anyhow",
"apollo-router",
@ -2638,7 +2638,7 @@ dependencies = [
[[package]]
name = "hive-console-sdk"
version = "0.1.1"
version = "0.2.0"
dependencies = [
"anyhow",
"async-trait",

View file

@ -1,6 +1,4 @@
// @ts-expect-error not a dependency
import { defineConfig } from '@graphql-hive/gateway';
// @ts-expect-error not a dependency
import { hiveTracingSetup } from '@graphql-hive/plugin-opentelemetry/setup';
import type { Context } from '@opentelemetry/api';
import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';
@ -69,6 +67,8 @@ if (
// Noop is only there to not raise an exception in case we do not hive console tracing.
target: process.env['HIVE_HIVE_TARGET'] ?? 'noop',
contextManager: new AsyncLocalStorageContextManager(),
// @ts-expect-error console uses otel v1 and hive gateway uses v2
// TODO: upgrade console to otel v2
processor: new MultiSpanProcessor([
...(process.env['HIVE_HIVE_TRACE_ACCESS_TOKEN'] &&
process.env['HIVE_HIVE_TRACE_ENDPOINT'] &&
@ -111,8 +111,8 @@ export const gatewayConfig = defineConfig({
},
supergraph: {
type: 'hive',
endpoint: process.env['SUPERGRAPH_ENDPOINT'],
key: process.env['HIVE_CDN_ACCESS_TOKEN'],
endpoint: process.env['SUPERGRAPH_ENDPOINT'] || '',
key: process.env['HIVE_CDN_ACCESS_TOKEN'] || '',
},
graphiql: {
title: 'Hive Console - GraphQL API',
@ -127,12 +127,13 @@ export const gatewayConfig = defineConfig({
},
},
disableWebsockets: true,
prometheus: true,
prometheus: {
metrics: true,
},
openTelemetry:
process.env['OPENTELEMETRY_COLLECTOR_ENDPOINT'] || process.env['HIVE_HIVE_TRACE_ACCESS_TOKEN']
? {
traces: true,
serviceName: 'public-graphql-api-gateway',
}
: undefined,
demandControl: {
@ -141,4 +142,8 @@ export const gatewayConfig = defineConfig({
},
maxTokens: 1_000,
maxDepth: 20,
cors: {
origin: '*', // allow all origins
credentials: false, // do not allow credentials in cross-origin requests
},
});

View file

@ -22,6 +22,7 @@
"prettier": "3.4.2"
},
"devDependencies": {
"@graphql-hive/gateway": "^2.1.19",
"@types/js-yaml": "4.0.9",
"@types/mime-types": "2.1.4",
"@types/node": "22.10.5",

View file

@ -15,7 +15,7 @@ import { type OTELCollector } from './otel-collector';
* Hive Gateway Docker Image Version
* Bump this to update the used gateway version.
*/
const dockerImage = 'ghcr.io/graphql-hive/gateway:2.1.10';
const dockerImage = 'ghcr.io/graphql-hive/gateway:2.1.19';
const gatewayConfigDirectory = path.resolve(
__dirname,

File diff suppressed because it is too large Load diff

View file

@ -74,6 +74,11 @@ async function rewritePackageJson(
});
}
const globalExternals: string[] = [
// TODO: dependency of hive gateway. why does it get built by all packages, mystery
'ansi-color',
];
async function compile(
cwd: string,
entryPoint: string | string[],
@ -96,7 +101,7 @@ async function compile(
shims: true,
skipNodeModulesBundle: false,
// noExternal: dependencies,
external: buildOptions.external,
external: [...globalExternals, ...(buildOptions.external || [])],
banner: {
js: requireShim,
},