File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
packages/tracing/src/integrations/node Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,33 @@ export class Apollo implements Integration {
3535 } > ( 'apollo-server-core' ) ;
3636
3737 if ( ! pkg ) {
38- logger . error ( 'Apollo Integration was unable to require apollo-server-core package.' ) ;
38+ __DEBUG_BUILD__ && logger . error ( 'Apollo Integration was unable to require apollo-server-core package.' ) ;
3939 return ;
4040 }
4141
4242 /**
4343 * Iterate over resolvers of the ApolloServer instance before schemas are constructed.
4444 */
4545 fill ( pkg . ApolloServerBase . prototype , 'constructSchema' , function ( orig : ( ) => unknown ) {
46- return function ( this : { config : { resolvers : ApolloModelResolvers [ ] } } ) {
46+ return function ( this : { config : { resolvers ?: ApolloModelResolvers [ ] ; schema ?: unknown ; modules ?: unknown } } ) {
47+ if ( ! this . config . resolvers ) {
48+ if ( __DEBUG_BUILD__ ) {
49+ if ( this . config . schema ) {
50+ logger . warn (
51+ 'Apollo integration is not able to trace `ApolloServer` instances constructed via `schema` property.' ,
52+ ) ;
53+ } else if ( this . config . modules ) {
54+ logger . warn (
55+ 'Apollo integration is not able to trace `ApolloServer` instances constructed via `modules` property.' ,
56+ ) ;
57+ }
58+
59+ logger . error ( 'Skipping tracing as no resolvers found on the `ApolloServer` instance.' ) ;
60+ }
61+
62+ return orig . call ( this ) ;
63+ }
64+
4765 const resolvers = arrayify ( this . config . resolvers ) ;
4866
4967 this . config . resolvers = resolvers . map ( model => {
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export class GraphQL implements Integration {
2323 } > ( 'graphql/execution/execute.js' ) ;
2424
2525 if ( ! pkg ) {
26- logger . error ( 'GraphQL Integration was unable to require graphql/execution package.' ) ;
26+ __DEBUG_BUILD__ && logger . error ( 'GraphQL Integration was unable to require graphql/execution package.' ) ;
2727 return ;
2828 }
2929
You can’t perform that action at this time.
0 commit comments