Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there anyway to make transform respect the scrubFields options? #1084

Open
npearson72 opened this issue Jan 4, 2023 · 1 comment
Open

Comments

@npearson72
Copy link

I have cases where I need to call Rollbar directly in my express code without relying on the middleware error handler. Which means I don't have access to the request object by default. So what I do is create a top-level middleware function that adds the request object to the Rollbar payload as the first order of business.

However when I do this, none of the scrubFields options are respected.

@waltjones
Copy link
Contributor

The transform function in the Rollbar config runs after the scrubber. Data added or modified there needs to be safe, or redacted as needed by the user function.

To send the request object and have it redacted by the scrubber, it should be passed as an argument to Rollbar.error().

Rollbar.error(err, request)

This works if:

  1. The request object is the first object or array argument. For example, if you pass a custom data object, put the request first.
  2. The object must have at least one of these keys present: 'headers', 'protocol', 'url', 'method', 'body', 'route'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants