Skip to content

[Bug]: Internal compiler error TypeError: fetch failed. #9786

@mcbeelen

Description

@mcbeelen

Describe the bug

On a laptop from work, behind a corporate firewall, which does SSL offloading, fetchPackageManifest fails due to Error: unable to get local issuer certificate
.. code: UNABLE_TO_GET_ISSUER_CERT_LOCALLY

On our machines NPM points to an internal NPM-registry and we run with npm config set strict-ssl false.

Direct outbound connections are blocked.

How do I configure tsp to ignore certifcate-errors?

Reproduction

√ Initialize a new project here?: Yes
√ Select a project template: Generic REST API
√ Enter a project name: typespec-poc
√ What emitters do you want to use?: OpenAPI 3.1 document       [@typespec/openapi3]

× Installing dependencies
Internal compiler error!
File issue at https://github.com/microsoft/typespec

TypeError: fetch failed
    at node:internal/deps/undici/undici:12618:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async fetchPackageManifest (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/package-manger/npm-registry-utils.js:8:17)
    at async installTypeSpecDependencies (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/install/install.js:110:26)
    at async file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/init/init.js:75:33
    at async trackAction (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/core/logger/console-sink.js:133:24)
    at async initTypeSpecProjectWorker (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/init/init.js:74:9)
    at async initTypeSpecProject (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/init/init.js:18:9)
    at async initAction (file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/core/cli/actions/init.js:7:9)
    at async file:///C:/Users/local-user-name/AppData/Roaming/npm/node_modules/@typespec/compiler/dist/src/core/cli/utils.js:35:29 {
  cause: Error: unable to get local issuer certificate
      at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)
      at TLSSocket.emit (node:events:518:28)
      at TLSSocket._finishInit (node:_tls_wrap:1085:8)
      at ssl.onhandshakedone (node:_tls_wrap:871:12)
      at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
  }
}

Checklist

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions