Skip to content

Nondescriptive Typeerror: Cannot read properties of undefined (reading 'reason') #1776

@Ethan-Arrowood

Description

@Ethan-Arrowood

Bug Description

Got a strange error using fetch,

TypeError: fetch failed
    at fetch (/home/runner/work/api/api/scripts/build-container/node_modules/undici/index.js:105:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getLatestVersionOfMajor (/home/runner/work/api/api/scripts/build-container/scripts/update-node.js:48:20)
    at async module.exports (/home/runner/work/api/api/scripts/build-container/scripts/update-node.js:139:22)
    at async eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13356:16), <anonymous>:4:1)
    at async main (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:13452:20) {
  cause: TypeError: Cannot read properties of undefined (reading 'reason')
      at makeAppropriateNetworkError (/home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/response.js:467:58)
      at schemeFetch (/home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/index.js:788:12)
      at /home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/index.js:605:22
      at mainFetch (/home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/index.js:655:7)
      at httpRedirectFetch (/home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/index.js:1230:10)
      at httpFetch (/home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/index.js:1091:24)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async schemeFetch (/home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/index.js:889:14)
      at async /home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/index.js:605:16
      at async mainFetch (/home/runner/work/api/api/scripts/build-container/node_modules/undici/lib/fetch/index.js:589:16)
}

The code is private, but the line that caused this is: const response = await fetch(`https://nodejs.org/dist/latest-v${major}.x`);. I'm investigating now. Most likely an issue on my end but we may be able to benefit from a better error message here.

Reproducible By

Expected Behavior

Logs & Screenshots

Environment

Additional context

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions