graphql-rails_logger
graphql-rails_logger copied to clipboard
Parsing error with `Rails.application.config.filter_parameters`
trafficstars
ActiveSupport::Notifications is throwing an exception, related to how this gem parses certain filtered objects.
To replicate, add the variables param to your list of filtered params config like so.
# config/initializers/filter_parameter_logging.rb
Rails.application.config.filter_parameters += [
:variables
]
Then making a GraphQL query will result in
Started POST "/v1/graphql" for 127.0.0.1 at 2022-03-02 12:34:55 -0600
Processing by API::GraphQLController#create as JSON
Could not log "start_processing.action_controller" event. JSON::ParserError: 451: unexpected token at 'FILTERED]' ...
This is what the output looks like without the graphql-rails_logger turned on:
Started POST "/v1/graphql" for 127.0.0.1 at 2022-03-02 12:38:57 -0600
Processing by API::GraphQLController#create as JSON
Parameters:
{"query"=>"{\n profile {\n id\n }\n}", "variables"=>"[FILTERED]", "graphql"=>{"query"=>"{\n profile {\n id\n }\n}", "variables"=>"[FILTERED]"}}