Skip to content

Commit 581bf69

Browse files
authored
ref(remix): Do not fail silently if getClientIpAddress throws error. (#6400)
1 parent 2fbaf45 commit 581bf69

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/remix/src/utils/web-fetch.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Based on Remix's implementation of Fetch API
22
// https://github.com/remix-run/web-std-io/tree/main/packages/fetch
33

4+
import { logger } from '@sentry/utils';
5+
46
import { getClientIPAddress } from './getIpAddress';
57
import { RemixRequest } from './types';
68

@@ -95,11 +97,11 @@ export const normalizeRemixRequest = (request: RemixRequest): Record<string, any
9597

9698
let ip;
9799

98-
// Using a try block here just to stay on the safe side
100+
// Using a try block here not to break the whole request if we can't get the IP address
99101
try {
100102
ip = getClientIPAddress(headers);
101103
} catch (e) {
102-
// ignore
104+
__DEBUG_BUILD__ && logger.warn('Could not get client IP address', e);
103105
}
104106

105107
// HTTP-network fetch step 4.2

0 commit comments

Comments
 (0)