Skip to content

Replace deprecated request package with axios in SQL Database Projects#21085

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/remove-deprecated-request-package
Draft

Replace deprecated request package with axios in SQL Database Projects#21085
Copilot wants to merge 5 commits intomainfrom
copilot/remove-deprecated-request-package

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Description

The request npm package (deprecated since Feb 2020) was used for streaming file downloads in SQL Database Projects. Replaced with axios which the extension already uses elsewhere.

Key Changes:

  • Removed request and @types/request dependencies
  • Migrated HttpClient.download() to use axios streaming (responseType: 'stream')
  • Fixed stream lifecycle management: error handlers registered before piping, proper cleanup on errors, guarded against multiple promise rejections

Implementation:

// Before: request.get() with callback-based streaming
let downloadRequest = request.get(downloadUrl, { timeout: DownloadTimeoutMs })
  .on('error', ...).on('response', ...).on('data', ...)
downloadRequest.pipe(fs.createWriteStream(targetPath))

// After: axios with promise-based streaming
const response = await axios({ method: 'GET', url: downloadUrl, responseType: 'stream', timeout })
response.data.on('error', handleError).on('data', ...)
response.data.pipe(writer)

Preserves all existing behavior: progress tracking, timeout handling, error reporting.

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: SQL Project is using deprecated request npm package</issue_title>
<issue_description>### Description

SQL Project extension has a dependency on "request": "^2.88.2", which according to the npmjs is deprecated. The related issue request/request#3142 says that the library isn't using modern patterns, etc., and that a new module should be used. We need to remove this package and move to a recommended alternative.

Image

Steps to Reproduce

  1. Run yarn install or look in package.json

Affected Area

  • Connection dialog (SQL Server | Azure browse/Fabric browse)
  • Query editor
  • Query results panel
  • Object Explorer
  • GitHub Copilot integration
  • Preview/Edit data
  • Table Designer
  • Schema Designer
  • Schema Compare
  • Local SQL Server Container provisioning
  • SQL database in Fabric provisioning
  • DACPAC/BACPAC export/import
  • SQL Database projects
  • Query Plan Visualizer
  • Other (please describe below)

If you selected "Other", please describe the affected area

No response

Environment Information

Latest main branch

Confirmation

  • I have searched existing issues and couldn't find a match
  • I want to work on this issue</issue_description>

<agent_instructions>Take a look at request/request#3142 if you need more context. Basically remove the deprecated package, and then find all uses of that package in the sql project extension in the extensions\sql-database-projects directory and update them. Also, if there are any sql project tests that use this package, get them too.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 3, 2026 16:24
Co-authored-by: kburtram <599935+kburtram@users.noreply.github.com>
Co-authored-by: kburtram <599935+kburtram@users.noreply.github.com>
Co-authored-by: kburtram <599935+kburtram@users.noreply.github.com>
Co-authored-by: kburtram <599935+kburtram@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove deprecated request npm package for SQL Project Replace deprecated request package with axios in SQL Database Projects Feb 3, 2026
Copilot AI requested a review from kburtram February 3, 2026 16:30

const contentLengthHeader = response.headers['content-length'];
const totalBytes = parseInt(contentLengthHeader || '0');
const totalMegaBytes = totalBytes / (1024 * 1024);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Maybe consolidate bytes to megabytes calculation and add a function in general utils.ts.

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 5523 KB 5523 KB ⚪ 0 KB ( 0% )
sql-database-projects VSIX 5683 KB 4918 KB 🟢 -765 KB ( -13% )
data-workspace VSIX 544 KB 544 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.89%. Comparing base (ed92a9a) to head (cf4583b).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #21085   +/-   ##
=======================================
  Coverage   67.89%   67.89%           
=======================================
  Files         230      230           
  Lines       22394    22394           
  Branches     2971     2971           
=======================================
  Hits        15204    15204           
  Misses       7059     7059           
  Partials      131      131           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SQL Project is using deprecated request npm package

4 participants