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

fix: add userAgent query parameter in debugger #237

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Changes from 1 commit
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
7 changes: 6 additions & 1 deletion src/expoDebuggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import {
import { ExpoProjectCache, ExpoProject, findProjectFromWorkspaces } from './expo/project';
import { debug } from './utils/debug';
import { featureTelemetry } from './utils/telemetry';
import { version as extensionVersion } from '../package.json';

const log = debug.extend('expo-debuggers');

const DEBUG_TYPE = 'expo';
const DEBUG_COMMAND = 'expo.debug.start';
const DEBUG_USER_AGENT = `vscode/${vscode.version} vscode-expo-tools/${extensionVersion}`;

interface ExpoDebugConfig extends vscode.DebugConfiguration {
projectRoot: string;
Expand Down Expand Up @@ -198,7 +200,10 @@ async function resolveDeviceConfig(config: ExpoDebugConfig, project: ExpoProject
workflow: device._workflow,

// The address of the device to connect to
websocketAddress: `${device.webSocketDebuggerUrl}&type=vscode`,
websocketAddress:
device.webSocketDebuggerUrl +
'&type=vscode' + // Adding the "classic" `type=vscode` query parameter (SDK <=49)
`&userAgent=${encodeURIComponent(DEBUG_USER_AGENT)}`, // Adding the modern "userAgent" query parameter (SDK >=50)s

// Define the required root paths to resolve source maps
localRoot: project.root,
Expand Down