@@ -12,8 +12,8 @@ use graph::data::value::{Object, Word};
1212use graph:: derive:: CheapClone ;
1313use graph:: prelude:: * ;
1414use graph:: schema:: {
15- ast as sast, INTROSPECTION_SCHEMA_FIELD_NAME , INTROSPECTION_TYPE_FIELD_NAME , META_FIELD_NAME ,
16- META_FIELD_TYPE ,
15+ ast as sast, INTROSPECTION_SCHEMA_FIELD_NAME , INTROSPECTION_TYPE_FIELD_NAME , LOGS_FIELD_NAME ,
16+ META_FIELD_NAME , META_FIELD_TYPE ,
1717} ;
1818use graph:: schema:: { ErrorPolicy , BLOCK_FIELD_TYPE } ;
1919
@@ -353,6 +353,23 @@ impl Resolver for StoreResolver {
353353 return Ok ( ( ) ) ;
354354 }
355355
356+ // Check if the query only contains debugging fields (_meta, _logs).
357+ // If so, don't add indexing errors - these queries are specifically for debugging
358+ // failed subgraphs and should work without errors.
359+ // Introspection queries (__schema, __type) still get the indexing_error to inform
360+ // users the subgraph has issues, but they return data.
361+ let only_debugging_fields = result
362+ . data ( )
363+ . map ( |data| {
364+ data. iter ( )
365+ . all ( |( key, _) | key == META_FIELD_NAME || key == LOGS_FIELD_NAME )
366+ } )
367+ . unwrap_or ( false ) ;
368+
369+ if only_debugging_fields {
370+ return Ok ( ( ) ) ;
371+ }
372+
356373 // Add the "indexing_error" to the response.
357374 assert ! ( result. errors_mut( ) . is_empty( ) ) ;
358375 * result. errors_mut ( ) = vec ! [ QueryError :: IndexingError ] ;
@@ -364,9 +381,10 @@ impl Resolver for StoreResolver {
364381 ErrorPolicy :: Deny => {
365382 let mut data = result. take_data ( ) ;
366383
367- // Only keep the _meta, __schema and __type fields from the data
384+ // Only keep the _meta, _logs, __schema and __type fields from the data
368385 let meta_fields = data. as_mut ( ) . and_then ( |d| {
369386 let meta_field = d. remove ( META_FIELD_NAME ) ;
387+ let logs_field = d. remove ( LOGS_FIELD_NAME ) ;
370388 let schema_field = d. remove ( INTROSPECTION_SCHEMA_FIELD_NAME ) ;
371389 let type_field = d. remove ( INTROSPECTION_TYPE_FIELD_NAME ) ;
372390
@@ -376,6 +394,9 @@ impl Resolver for StoreResolver {
376394 if let Some ( meta_field) = meta_field {
377395 meta_fields. push ( ( Word :: from ( META_FIELD_NAME ) , meta_field) ) ;
378396 }
397+ if let Some ( logs_field) = logs_field {
398+ meta_fields. push ( ( Word :: from ( LOGS_FIELD_NAME ) , logs_field) ) ;
399+ }
379400 if let Some ( schema_field) = schema_field {
380401 meta_fields
381402 . push ( ( Word :: from ( INTROSPECTION_SCHEMA_FIELD_NAME ) , schema_field) ) ;
0 commit comments