Skip to content

Commit 8670611

Browse files
committed
feat(browser): Set user.ip_address explicitly to {{auto}}
1 parent 64e9fb6 commit 8670611

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/browser/src/client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ export class BrowserClient extends Client<BrowserClientOptions> {
112112
isolationScope: Scope,
113113
): PromiseLike<Event | null> {
114114
event.platform = event.platform || 'javascript';
115+
116+
// By default, we want to infer the IP address, unless this is explicitly set to `null`
117+
if (typeof event.user?.ip_address === 'undefined') {
118+
event.user = {
119+
...event.user,
120+
ip_address: '{{auto}}',
121+
};
122+
}
123+
115124
return super._prepareEvent(event, hint, currentScope, isolationScope);
116125
}
117126
}

0 commit comments

Comments
 (0)