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

Race conditions when requesting shortened URLs #2390

Closed
1 of 2 tasks
johnlinp opened this issue Nov 22, 2024 · 0 comments · Fixed by #2391
Closed
1 of 2 tasks

Race conditions when requesting shortened URLs #2390

johnlinp opened this issue Nov 22, 2024 · 0 comments · Fixed by #2391

Comments

@johnlinp
Copy link
Contributor

Describe the bug

  • Node.js version: 20.10.0
  • OS & version: Ubuntu 22.04.5 LTS

When making requests to various types of URLs, we see some failures for shortened URLs. The failures are not consistent, so I assume there is some race conditions going on.

The error logs look like this:

Nov 20 23:41:08 info: got-scraping called; parameters: (url:'https://fcld.ly/5hdnik1', ...) 
Nov 20 23:41:08 file:///app/node_modules/got/dist/source/core/index.js:446 
Nov 20 23:41:08                 if (this._request._writableState?.errored) { 
Nov 20 23:41:08                                   ^   
Nov 20 23:41:08 TypeError: Cannot read properties of undefined (reading '_writableState') 
Nov 20 23:41:08     at ClientRequest.<anonymous> (file:///app/node_modules/got/dist/source/core/index.js:446:35) 
Nov 20 23:41:08     at Object.onceWrapper (node:events:628:28) 
Nov 20 23:41:08     at ClientRequest.emit (node:events:526:35) 
Nov 20 23:41:08     at request.emit (file:///app/node_modules/got-scraping/dist/index.js:434:14) 
Nov 20 23:41:08     at onFinish (node:_http_outgoing:1005:10) 
Nov 20 23:41:08     at afterWrite (node:internal/streams/writable:693:5) 
Nov 20 23:41:08     at onwrite (node:internal/streams/writable:671:7) 
Nov 20 23:41:08     at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:106:10) 
Nov 20 23:41:08     at WriteWrap.callbackTrampoline (node:internal/async_hooks:130:17) 

Actual behavior

The call fails inconsistently (sometimes successful, sometimes fails)

Expected behavior

The call should be successful

Code to reproduce

The code is calling got-scraping (https://github.com/apify/got-scraping), but I think the problem lies in got.

const response = await gotScraping({
    url: 'https://fcld.ly/5hdnik1',
    throwHttpErrors: true,
    timeout: {
        request: 20000
    }
});

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.
johnlinp added a commit to johnlinp/got that referenced this issue Nov 22, 2024
johnlinp added a commit to johnlinp/got that referenced this issue Nov 23, 2024
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 a pull request may close this issue.

1 participant