Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout is not appropriate #313

Open
Bisstocuz opened this issue Jul 27, 2023 · 9 comments
Open

timeout is not appropriate #313

Bisstocuz opened this issue Jul 27, 2023 · 9 comments

Comments

@Bisstocuz
Copy link
Contributor

Bisstocuz commented Jul 27, 2023

I'm using vite-plugin-jspm to build app.

tracemap/resolve: ./eq.js https://unpkg.com/[email protected]/_assocIndexOf.js -> https://unpkg.com/[email protected]/eq.js (URL resolution)
tracemap/resolve: ./eq.js https://unpkg.com/[email protected]/_assocIndexOf.js -> https://unpkg.com/[email protected]/eq.js (URL resolution)
tracemap/resolve: ./eq.js https://unpkg.com/[email protected]/_assocIndexOf.js -> https://unpkg.com/[email protected]/eq.js (URL resolution)
tracemap/resolve: @vue/shared https://unpkg.com/[email protected]/es/components/space/src/use-space.mjs -> https://unpkg.com/@vue/[email protected]/dist/shared.esm-bundler.js (installation resolution)
tracemap/resolve: @vue/reactivity https://unpkg.com/[email protected]/es/hooks/use-lockscreen/index.mjs -> https://unpkg.com/@vue/[email protected]/dist/reactivity.esm-bundler.js (installation resolution)
tracemap/resolve: @vue/shared https://unpkg.com/[email protected]/es/components/message/src/method.mjs -> https://unpkg.com/@vue/[email protected]/dist/shared.esm-bundler.js (installation resolution)
/app/node_modules/.pnpm/[email protected]/node_modules/minipass-fetch/lib/index.js:110
      reject(new FetchError(`request to ${request.url} failed, reason: ${
             ^

FetchError: request to https://unpkg.com/element-plus@2.3.8/es/components/drawer/index.mjs failed, reason: Socket timeout
    at ClientRequest.<anonymous> (/app/node_modules/.pnpm/registry.npmmirror.com+minipass-fetch@1.4.1/node_modules/minipass-fetch/lib/index.js:110:14)
    at ClientRequest.emit (node:events:514:28)
    at TLSSocket.socketErrorListener (node:_http_client:501:9)
    at TLSSocket.emit (node:events:526:35)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at listOnTimeout (node:internal/timers:538:9)
    at process.processTimers (node:internal/timers:512:7) {
  code: 'ERR_SOCKET_TIMEOUT',
  timeout: 4000,
  errno: 'ERR_SOCKET_TIMEOUT',
  type: 'system'
}

Node.js v18.17.0
 ELIFECYCLE  Command failed with exit code 1.
ERROR: "build-prod" exited with 1.
 ELIFECYCLE  Command failed with exit code 1.

I tried visit https://unpkg.com/[email protected]/es/components/drawer/index.mjs later, it responses successfully after several seconds.

Is there any options to set timeout?

@guybedford
Copy link
Member

Thanks for posting, the timeout is not currently configurable but can be configured through the fetch options for make-fetch-happen. This is called in https://github.com/jspm/generator/blob/main/src/common/fetch-node.ts and the timeout docs can be found at https://github.com/npm/make-fetch-happen#--optsretry.

It should be straightforward to wire through an option, or simply extend the default - would you be able to try making a PR for that? If not I can make the update this week as well.

@Bisstocuz
Copy link
Contributor Author

Bisstocuz commented Aug 16, 2023

Thanks for posting, the timeout is not currently configurable but can be configured through the fetch options for make-fetch-happen. This is called in https://github.com/jspm/generator/blob/main/src/common/fetch-node.ts and the timeout docs can be found at https://github.com/npm/make-fetch-happen#--optsretry.

It should be straightforward to wire through an option, or simply extend the default - would you be able to try making a PR for that? If not I can make the update this week as well.

I guess my implement is still buggy, because I use vite-plugin-jspm with options:

export default defineConfig(({ mode }) => {
	return {
		plugins: [
			vue(),
			vueJsx(),
			jspmPlugin({
				fetchOptions: {
					timeout: 10000,
					maxSockets: 4,
				},
				defaultProvider: 'unpkg',
				debug: true
			}),
		],

Then still received:

C:\Users\test\Documents\MBDownload\frontend\node_modules\.pnpm\r[email protected]\node_modules\minipass-fetch\lib\index.js:110
      reject(new FetchError(`request to ${request.url} failed, reason: ${
             ^

FetchError: request to https://unpkg.com/element-plus@2.3.9/theme-chalk/el-message.css failed, reason: Socket timeout
    at ClientRequest.<anonymous> (C:\Users\test\Documents\project\frontend\node_modules\.pnpm\registry.npmmirror.com+minipass-fetch@1.4.1\node_modules\minipass-fetch\lib\index.js:110:14)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:502:9)
    at TLSSocket.emit (node:events:525:35)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ERR_SOCKET_TIMEOUT',
  timeout: 4000,
  errno: 'ERR_SOCKET_TIMEOUT',
  type: 'system'
}

Node.js v18.15.0
 ELIFECYCLE  Command failed with exit code 1.
ERROR: "build-prod" exited with 1.
 ELIFECYCLE  Command failed with exit code 1.

Could you please help review the whole function calling chain? I am not talented at JavaScript.

@guybedford
Copy link
Member

@Bisstocuz ahh, looking at the stack more carefully we don't actually use minipass-fetch so that is likely used specifically in the Vite plugin or Vite fetch implementation.

@Bisstocuz
Copy link
Contributor Author

@Bisstocuz ahh, looking at the stack more carefully we don't actually use minipass-fetch so that is likely used specifically in the Vite plugin or Vite fetch implementation.

@JayaKrishnaNamburu Hey do you have any ideas about this issue?

@JayaKrishnaNamburu
Copy link
Member

JayaKrishnaNamburu commented Aug 17, 2023

@Bisstocuz
Copy link
Contributor Author

Bisstocuz commented Aug 17, 2023

@Bisstocuz can you try using the latest [email protected]. It uses the latest @jspm/[email protected] which supports fetchOptions

https://www.npmjs.com/package/vite-plugin-jspm?activeTab=code https://github.com/jspm/generator/releases/tag/1.1.10

I don't know why it reported:

 ERR_PNPM_NO_MATCHING_VERSION  No matching version found for [email protected]

This error happened while installing a direct dependency of C:\Users\test\Documents\MBDownload\frontend

The latest release of vite-plugin-jspm is "0.5.0".

If you need the full list of all 8 published versions run "$ pnpm view vite-plugin-jspm versions".

@JayaKrishnaNamburu
Copy link
Member

That's a bit weird, given it is already available in npm 🤔

@JayaKrishnaNamburu
Copy link
Member

Any updates on this @Bisstocuz, were you able to make it work

@Bisstocuz
Copy link
Contributor Author

Any updates on this @Bisstocuz, were you able to make it work

Still error, I am planned to check this issue several days later.

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

No branches or pull requests

3 participants