getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.97k stars 1.57k forks source link

Enabling geolocation for node.js #4541

Closed drmrbrewer closed 2 years ago

drmrbrewer commented 2 years ago

Package + Version

Version:

22.2.0.dev0

Description

Possibly not a bug but just a missing feature, but there does not appear to be any way of enabling sendDefaultPii in the node.js configuration options. Does this mean that geolocation functionality just isn't available for node.js?

In the above docs for geolocation it states:

image

This links through to some info about having to enable send_default_pii but this is a python configuration option and there doesn't appear to be any equivalent sendDefaultPii option for node.js?

Or is there some other way to do this for node.js?

AbhiPrasad commented 2 years ago

Hey, thanks for writing in!

You're right that there is no sendDefaultPii option in the JavaScript SDKs. You'll have to do this yourself. Please see our docs on how to attach IP addresses to your Sentry event.

Like so:

import * as Sentry from '@sentry/node';

Sentry.init({
  dsn: "__YOUR_DSN__",
  // the rest of config
});

Sentry.setUser({ ip_address: '{{auto}}' }); // it has to be done just once

Sentry.captureException(new Error('wat'));
drmrbrewer commented 2 years ago

Thanks, works nicely!