diff --git a/http/index.mjs b/http/index.mjs index d3badc8b..40d877d0 100644 --- a/http/index.mjs +++ b/http/index.mjs @@ -2,14 +2,12 @@ import cluster from 'node:cluster'; import os from 'node:os'; import * as Sentry from "@sentry/node"; import "./instrument.mjs"; -import express from 'express'; import { createServer } from 'node:http'; import 'dotenv/config'; import getYoga from '../graphql-yoga.mjs'; import getEnv from './env-binding.mjs'; -import * as Sentry from "@sentry/node"; const port = process.env.PORT ?? 8788; const workerCount = parseInt(process.env.WORKERS ?? String(os.cpus().length - 1)); diff --git a/utils/cache-machine.mjs b/utils/cache-machine.mjs index 222f8cdb..a8bb71fc 100644 --- a/utils/cache-machine.mjs +++ b/utils/cache-machine.mjs @@ -63,7 +63,9 @@ async function updateCache(env, query, variables, body, ttl = '', specialCache = method: 'POST', headers: { 'content-type': 'application/json;charset=UTF-8', - 'Authorization': `Basic ${env.CACHE_BASIC_AUTH}` + 'Authorization': `Basic ${env.CACHE_BASIC_AUTH}`, + 'sentry-trace': Sentry.getCurrentHub().getScope().getSpan().toTraceparent(), + 'baggage': Sentry.getCurrentHub().getScope().getSpan().toBaggageHeader() }, timeout: 10000, }; @@ -109,11 +111,11 @@ async function checkCache(env, query, variables, specialCache = '') { return false; } - const response = await fetchWithTimeout(`${cacheUrl}/api/cache?key=${cacheKey}`, { + const response = await fetchWithTimeout(`${cacheUrl}/api/cache?key=${cacheKey}`, { headers: { 'content-type': 'application/json;charset=UTF-8', 'Authorization': `Basic ${env.CACHE_BASIC_AUTH}` - }, + }, }); cacheFailCount = 0; if (response.status === 200) {