hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

MiniOxygen: Error during evaluation: TypeError: fetch failed

Open narayanpromax opened this issue 4 months ago • 2 comments

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

@shopify/hydrogen: 2025.7.0 && @shopify/mini-oxygen: ^4.0.0 && @shopify/cli: 3.85.4

What version of Remix are you using?

No response

Steps to Reproduce

Install fresh hydrogen latest version and do a mockup or link to existing store and run

npm run dev

Expected Behavior

It should open in browser mock data or linked shop

Actual Behavior

MiniOxygen: Error during evaluation: TypeError: fetch failed
    at Object.fetch (/Users/devco/Dev/newshop.kisanestore.com/node_modules/miniflare/node_modules/undici/index.js:112:15)
    at fetch3 (/Users/devco/Dev/newshop.kisanestore.com/node_modules/miniflare/src/http/fetch.ts:90:19)
    at Miniflare2.dispatchFetch (/Users/devco/Dev/newshop.kisanestore.com/node_modules/miniflare/src/index.ts:1680:20)
    at Object.dispatchFetch (file:///Users/devco/Dev/newshop.kisanestore.com/node_modules/@shopify/mini-oxygen/dist/worker/index.js:81:24) {
  cause: HeadersTimeoutError: Headers Timeout Error
      at Timeout.onParserTimeout [as callback] (/Users/devco/Dev/newshop.kisanestore.com/node_modules/miniflare/node_modules/undici/lib/client.js:1048:28)
      at Timeout.onTimeout [as _onTimeout] (/Users/devco/Dev/newshop.kisanestore.com/node_modules/miniflare/node_modules/undici/lib/timers.js:20:13)
      at listOnTimeout (node:internal/timers:588:17)
      at processTimers (node:internal/timers:523:7) {
    code: 'UND_ERR_HEADERS_TIMEOUT'
  }
}

narayanpromax avatar Oct 15 '25 13:10 narayanpromax

Please share your node -v version and ensure it is inline with our supported versions in dev.yaml

juanpprieto avatar Oct 22 '25 17:10 juanpprieto

Also seeing a similar issue @juanpprieto after upgrading to the latest Hydrogen. Same package versions as above and node v22.15.0:

MiniOxygen: Error during evaluation: TypeError: fetch failed
[1]     at Object.fetch (\node_modules\miniflare\node_modules\undici\index.js:112:15)
[1]     at async fetch3 (\node_modules\miniflare\src\http\fetch.ts:90:19)
[1]     at async Miniflare2.dispatchFetch (\node_modules\miniflare\src\index.ts:1680:20)
[1]     at async Object.dispatchFetch (file:///node_modules/@shopify/mini-oxygen/dist/worker/index.js:81:24) {
[1]   cause: HeadersTimeoutError: Headers Timeout Error
[1]       at Timeout.onParserTimeout [as callback] (\node_modules\miniflare\node_modules\undici\lib\client.js:1048:28)
[1]       at Timeout.onTimeout [as _onTimeout] (\node_modules\miniflare\node_modules\undici\lib\timers.js:20:13)
[1]       at listOnTimeout (node:internal/timers:588:17)
[1]       at processTimers (node:internal/timers:523:7) {
[1]     code: 'UND_ERR_HEADERS_TIMEOUT'
[1]   }
[1] }

After trying to run the dev server multiple times it does seem to work sometimes, but most of the time I encounter the error above.

When it does work it can still hang for a long time on the initial request, finally loading with the following error:

[1] A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.
[1] [Error: The script will never generate a response.]
[1] Warning: A promise was resolved or rejected from a different request context than the one it was created in. However, the creating request has already been completed or canceled. Continuations for that request are unlikely to run safely and have been canceled. If this behavior breaks your worker, consider setting the `no_handle_cross_request_promise_resolution` compatibility flag for your worker.
[1]     at ModuleRunner.import (/node_modules/@shopify/mini-oxygen/dist/vite/worker-entry.js:1114:12)

In some cases I continue to see the above error on every refresh or navigation, initially loading the page and then throwing this error and redirecting to the error boundary.

diced-dev avatar Oct 28 '25 04:10 diced-dev

This issue has been marked as stale due to inactivity for 60 days. Please comment or update if this is still relevant, otherwise it will be closed in 7 days.

github-actions[bot] avatar Jan 15 '26 16:01 github-actions[bot]