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

Use built-in fetch #18

Merged
merged 1 commit into from Feb 14, 2024
Merged

Use built-in fetch #18

merged 1 commit into from Feb 14, 2024

Conversation

azu
Copy link
Contributor

@azu azu commented Feb 14, 2024

This change is to stabilize the behavior of fetch.

Changes

  • Use native-fetch instead of node-fetch
    • Node.js 18 support fetch
  • Implement fetchWithRetry

Details

node-fetch has an issue

When I was running it locally, the next error occurred frequently.

:error: FetchError: request to https://tc39.es/proposal-regexp-dotall-flag/ failed, reason: read ECONNRESET
    at ClientRequest.<anonymous> (file:///Users/azu/ghq/github.com/tc39/dataset/node_modules/node-fetch/src/index.js:108:11)
    at ClientRequest.emit (node:events:517:28)
    at TLSSocket.socketErrorListener (node:_http_client:501:9)
    at TLSSocket.emit (node:events:517:28)
    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) {
  type: 'system',
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  erroredSysCall: 'read'
}

This problem is hard to occur in native fetch.

Addtionaly, I have implemented fetch retry.

@Jack-Works
Copy link
Member

thank you!

@Jack-Works Jack-Works changed the title Make fetch stable Use built-in fetch Feb 14, 2024
@Jack-Works Jack-Works merged commit 6273302 into tc39:master Feb 14, 2024
@azu azu deleted the stable-fetch branch February 14, 2024 23:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants