-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Describe the bug
On receiving an response from graphql which contains an error the following error is emmited in logs and the entire Rum Resource Event is dropped.
ArgumentError when calling rum.stopResource: parameter null. It looks like _dd.graphql.errors is of type MappedListIterable<GraphQLError, Map<String, Object?>>, which is not supported.
I believe the error to be from: https://github.com/DataDog/dd-sdk-flutter/blob/develop/packages/datadog_gql_link/lib/src/datadog_gql_link.dart#L112
where a toList() may be a simple fix.
Reproduction steps
call graphql and get a 200 response that contains an error blob and a data blob.
Response Object appears like (in debugger)
Response( data: {__typename: Query, me: {__typename: Member, offers: null}}, errors: [GraphQLError(message: java.lang.RuntimeException: An unexpected error occurred for operation: service_client.<redacted>.fetch_member, partyId: <redacted>, locations: [ErrorLocation(line: 5, column: 5)], path: [me, offers], extensions: {errorType: INTERNAL})], context: Context({ResponseExtensions: Instance of 'ResponseExtensions', HttpLinkResponseContext: Instance of 'HttpLinkResponseContext'}), response {errors: [{message: java.lang.RuntimeException: An unexpected error occurred for operation: service_client.<redacted>.fetch_member, partyId: <redacted>, locations: [{line: 5, column: 5}], path: [me, offers], extensions: {errorType: INTERNAL}}], data: {__typename: Query, me: {__typename: Member, offers: null}}} )
SDK logs
ArgumentError when calling rum.stopResource: parameter null. It looks like _dd.graphql.errors is of type MappedListIterable<GraphQLError, Map<String, Object?>>, which is not supported.
Expected behavior
errors should be a list of Object, not a MappedListIterable<GraphQLError, Map<String, Object?>>
additionally, ideally attributes of incorrect/unsupported types should not prevent the event from firing!
Affected SDK versions
datadog_flutter_plugin: 2.11.0, datadog_gql_link: 1.1.1
Latest working SDK version
No response
Did you confirm if the latest SDK version fixes the bug?
No
Flutter Version
3.27.4
Setup Type
No response
Device Information
No response
Other relevant information
No response