Skip to content

Cannot start Vite dev server with proxy environment variables #8906

@satgo1546

Description

@satgo1546

Which Cloudflare product(s) does this pertain to?

Vite Plugin

What versions & operating system are you using?

@cloudflare/vite-plugin 1.0.5, Windows 11 WSL 2 (Arch)

Please provide a link to a minimal reproduction

No response

Describe the Bug

  1. Create a new Cloudflare Workers project with npm create cloudflare@latest. Choose Framework Starter, then React or Vue. Accept default values for other options.
  2. Start the dev server with proxy environment variables set. The dev server should work but it does not.

In the following example, an HTTP proxy server on port 11451 has been properly set up.

$ http_proxy=http://127.0.0.1:11451 npm run dev

> [email protected] dev
> vite

Proxy environment variables detected. We'll use your proxy for fetch requests.
error when starting dev server:
TypeError: fetch failed
    at node:internal/deps/undici/undici:13502:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async InspectorProxyController.updateConnection (/home/runner/weathered-truth-0d9c/node_modules/miniflare/dist/src/index.js:14520:34)
    at async #assembleAndUpdateConfig (/home/runner/weathered-truth-0d9c/node_modules/miniflare/dist/src/index.js:15861:9)
    at async Mutex.runWith (/home/runner/weathered-truth-0d9c/node_modules/miniflare/dist/src/index.js:1660:48)
    at async #waitForReady (/home/runner/weathered-truth-0d9c/node_modules/miniflare/dist/src/index.js:15920:5)
    at async _Miniflare._getProxyClient (/home/runner/weathered-truth-0d9c/node_modules/miniflare/dist/src/index.js:16046:5)
    at async _Miniflare.getWorker (/home/runner/weathered-truth-0d9c/node_modules/miniflare/dist/src/index.js:16091:25)
    at async file:///home/runner/weathered-truth-0d9c/node_modules/@cloudflare/vite-plugin/dist/index.js:13198:24
    at async Promise.all (index 0)

Please provide any relevant error logs

As seen above.

Metadata

Metadata

Assignees

Labels

bugSomething that isn't workingvite-pluginRelating to the `@cloudflare/vite-plugin` package

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions