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

RequestError: read ECONNRESET #31

Open
younho9 opened this issue Feb 1, 2022 · 2 comments
Open

RequestError: read ECONNRESET #31

younho9 opened this issue Feb 1, 2022 · 2 comments

Comments

@younho9
Copy link

younho9 commented Feb 1, 2022

Environment

  • MacOS Monterey 12.1
  • Node v16.13.2
  • Alfred 4.6.2

When I type anything, an error occurs.

"items": [
	{
		"title": "RequestError: read ECONNRESET",
		"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
		"valid": false,
		"text": {
			"copy": "```\nRequestError: read ECONNRESET\n    at ClientRequest.<anonymous> (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/got/dist/source/core/index.js:962:111)\n    at ClientRequest.origin.emit (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n```\n\n-\nnpms 3.0.0\nAlfred 4.6.2\ndarwin 21.2.0",
			"largetype": "RequestError: read ECONNRESET\n    at ClientRequest.<anonymous> (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/got/dist/source/core/index.js:962:111)\n    at ClientRequest.origin.emit (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)"
		},
		"icon": {
			"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
		}
	}
]

I found this issue comment, request/request-promise#147 (comment), and I added Connection: 'keep-alive' header to alfred-npms/node_modules/alfy/index.js:137 then the error has been resolved.

response = await got(url, {headers: {Connection: 'keep-alive'}, searchParams: options.query}).json();

Is there anyone else who experiences this error? I wonder if should add a Connection: 'keep-alive' header to the alfy.fetch.

@sindresorhus
Copy link
Owner

It's too opinionated to put in alfy.fetch, but I don't mind adding it here as it could speed up subsequent requests. PR welcome.

@younho9
Copy link
Author

younho9 commented Feb 6, 2022

But, alfy.fetch doesn't pass any other options except searchParams to got. How could I add header option here without modifying alfy.fetch?

https://github.com/sindresorhus/alfy/blob/main/index.js#L136-L138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants