Skip to content

ref(remix): Do not fail silently if getClientIpAddress throws error. #6400

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

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/remix/src/utils/web-fetch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Based on Remix's implementation of Fetch API
// https://github.com/remix-run/web-std-io/tree/main/packages/fetch

import { logger } from '@sentry/utils';

import { getClientIPAddress } from './getIpAddress';
import { RemixRequest } from './types';

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

let ip;

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

// HTTP-network fetch step 4.2
Expand Down