Skip to content

Add global-agent to CLI for proxying - #5520

Merged
blittle merged 6 commits into
mainfrom
add-http-agent-proxying
Apr 4, 2025
Merged

blittle merged 6 commits into
mainfrom
add-http-agent-proxying

Conversation

@craigmichaelmartin

@craigmichaelmartin craigmichaelmartin commented Mar 13, 2025 •

Copy link
Copy Markdown
Contributor

Original: #3244

WHY are these changes introduced?

#3225

WHAT is this pull request doing?

Uses global-agent to allow users to set up HTTP(S) proxying as they see fit.

How to test your changes?

Test commands with one of each SHOPIFY_HTTP_PROXY, SHOPIFY_HTTPS_PROXY, SHOPIFY_NO_PROXY env vars set. Similar to Apollo https://www.apollographql.com/docs/apollo-server/v3/proxy-configuration/

Post-release steps

We'll need docs on shopify.dev for this

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

@github-actions

github-actions Bot commented Mar 13, 2025 •

Copy link
Copy Markdown
Contributor

Coverage report

St.❔
Category Percentage Covered / Total
🟡 Statements
76.56% (-0.01% 🔻)
9398/12275
🟡 Branches 71.71% 4606/6423
🟡 Functions 76.33% 2441/3198
🟡 Lines
77.09% (-0.01% 🔻)
8886/11527
Show files with reduced coverage 🔻
St.❔
File Statements Branches Functions Lines
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
88% (-4% 🔻)
100%
98.33% (-1.67% 🔻)

Test suite run success

2171 tests passing in 953 suites.

Report generated by 🧪jest coverage report action from 4c6acaa

@craigmichaelmartin
craigmichaelmartin force-pushed the add-http-agent-proxying branch 2 times, most recently from baacf54 to cd82238 Compare March 13, 2025 17:01
@craigmichaelmartin

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

Copy link
Copy Markdown
Contributor

🫰✨ Thanks @craigmichaelmartin! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/[email protected]

Tip

If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

Comment thread packages/cli/src/index.ts Resolved
Comment thread packages/cli/src/index.ts
// Setup global support for environment variable based proxy configuration.
createGlobalProxyAgent({
environmentVariableNamespace: 'SHOPIFY_',
forceGlobalAgent: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We set a http agent in the http module. As-is, I think this will automatically replace it. I'm not sure what's the best solve here: we want the http agent to both have proxy support & to have our custom options.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@blittle

blittle commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

@craigmichaelmartin here's a working PR that fixes Hydrogen's dev server to use a proxy: Shopify/hydrogen#2831

@craigmichaelmartin
craigmichaelmartin marked this pull request as ready for review April 1, 2025 16:02
@craigmichaelmartin
craigmichaelmartin requested a review from a team as a code owner April 1, 2025 16:02
@blittle
blittle force-pushed the add-http-agent-proxying branch 2 times, most recently from f4f528e to b822a09 Compare April 1, 2025 18:40
@github-actions

This comment has been minimized.

@blittle

blittle commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

/snapit

@github-actions

github-actions Bot commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

🫰✨ Thanks @blittle! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/[email protected]

Tip

If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@blittle
blittle force-pushed the add-http-agent-proxying branch from 1c0d679 to 2053ed4 Compare April 3, 2025 19:49
@blittle

blittle commented Apr 3, 2025

Copy link
Copy Markdown
Contributor

/snapit

@github-actions

github-actions Bot commented Apr 3, 2025

Copy link
Copy Markdown
Contributor

🫰✨ Thanks @blittle! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/[email protected]

Tip

If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@blittle
blittle force-pushed the add-http-agent-proxying branch from 2053ed4 to 4c6acaa Compare April 4, 2025 13:37
@blittle
blittle requested a review from a team as a code owner April 4, 2025 13:37
@blittle
blittle added this pull request to the merge queue Apr 4, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Apr 4, 2025
Add global-agent to CLI for proxying
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 4, 2025
@blittle
blittle added this pull request to the merge queue Apr 4, 2025
Merged via the queue into main with commit 1964a07 Apr 4, 2025
@blittle
blittle deleted the add-http-agent-proxying branch April 4, 2025 15:56
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.

3 participants