Skip to content

Commit

Permalink
Disable plugin by default (#8334)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Walker-GM authored May 15, 2023
1 parent edb8e11 commit 3082b77
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/graphql-server/src/functions/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import type {
import { GraphQLSchema, OperationTypeNode } from 'graphql'
import { Plugin, useReadinessCheck, createYoga } from 'graphql-yoga'

import { getConfig } from '@redwoodjs/project-config'

import { mapRwCorsOptionsToYoga } from '../cors'
import { makeDirectivesForPlugin } from '../directives/makeDirectives'
import { getAsyncStoreInstance } from '../globalContext'
Expand Down Expand Up @@ -114,7 +116,16 @@ export const createGraphQLHandler = ({
plugins.push(...redwoodDirectivePlugins)

// Custom Redwood OpenTelemetry plugin
plugins.push(useRedwoodOpenTelemetry())
let openTelemetryPluginEnabled = false
try {
openTelemetryPluginEnabled = getConfig().experimental.opentelemetry.enabled
} catch (_error) {
// Swallow this error for the time being as we don't always have access to the
// config toml depending on the deploy environment
}
if (openTelemetryPluginEnabled) {
plugins.push(useRedwoodOpenTelemetry())
}

// Secure the GraphQL server
plugins.push(useArmor(logger, armorConfig))
Expand Down

0 comments on commit 3082b77

Please sign in to comment.