Skip to content

Ruby SDK reject_params throws JSON parsing error #760

Open
@EOengineer

Description

@EOengineer

Description

When I use the reject_params configuration option I get the following error:

WARN -- : The following error occured when trying to log to the ReadMe metrics API: 783: unexpected token at ''. Request not logged.

To Reproduce

Clone my test/reproduction app here

install

# install deps
bundle install

# create a .env file at project root with README_API_KEY=your-valid-api-key

# start the server
rails s

Fire off a JSON API GET request to localhost:3000/api/participants - error should be visible in console
Remove reject_params config option, the code works as expected.

Additional details

Config looks like

Rails.application.config.middleware.use Readme::Metrics, {
  api_key: ENV['README_API_KEY'],
  reject_params: ['data'],
} do |env|
  {
    api_key: 'key',
    label: 'name,
    email: '[email protected]',
  }
end

System details:

Ruby v2.7.6
Rails v6.0.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrubyIssues related to our Ruby SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions