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

Bun throws error 'A retry listener has been attached already' #2299

Open
iamkhalidbashir opened this issue Sep 12, 2023 · 8 comments
Open

Bun throws error 'A retry listener has been attached already' #2299

iamkhalidbashir opened this issue Sep 12, 2023 · 8 comments

Comments

@iamkhalidbashir
Copy link

Bun throws error on this line

https://github.com/sindresorhus/got/blob/944caa8ce8151d7b18ab17c4130b18d622c04ebe/source/core/index.ts#L219C3-L224C1

@sindresorhus
Copy link
Owner

If this only happens on Bun and not Node.js, you need to report it in the Bun issue tracker. They claim Node.js compatibility, so they need to resolve any Node.js compatibility issues.

@iamkhalidbashir
Copy link
Author

It makes sense, you can close this if you'd like
but I think its a small fix as all of other packages dosent give an issue with bun
so if you could look into it, would appreciate it.

@erictheswift
Copy link

As I understand, issue is bun firing newListener event after listener have been added, while node fires when the listener is about to be added but not added yet.

fix is stuck oven-sh/bun#4395

@erictheswift
Copy link

Unfortunately this isn't the only thing where bun fails in got,
e.g. if I ditch the retry checker, then

    typedResponse.statusMessage = typedResponse.statusMessage ?? http.STATUS_CODES[statusCode];

throws

TypeError: Attempted to assign to readonly property.

also bun seems to freeze 2 times out of 3 not resolving a single request response forever — didn't dive deep into why )

@bryanjtc
Copy link

Does 1.0.13 fix the issue?

@Thinkscape
Copy link

Does 1.0.13 fix the issue?

nope :(

@prabhu
Copy link

prabhu commented May 28, 2024

With got 14.3.0, I am getting

767 |             const cacheRequest = cacheableStore.get(options.cache)(options, async (response) => {
768 |                 response._readableState.autoDestroy = false;
769 |                 if (request) {
770 |                     const fix = () => {
771 |                         if (response.req) {
772 |                             response.complete = response.req.res.complete;
                                                      ^
TypeError: undefined is not an object (evaluating 'response.req.res.complete')
      at fix (/home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:772:49)
      at /home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:776:21
      at /home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:767:84
      at /home/runner/work/cdxgen/cdxgen/node_modules/cacheable-request/dist/index.js:148:25
      at handler (/home/runner/work/cdxgen/cdxgen/node_modules/cacheable-request/dist/index.js:77:40)
      at node:http:930:191

@ibash
Copy link

ibash commented May 28, 2024

fwiw after hitting this we just opted to use ky which is basically the same thing but works with fetch, so it works on bun.

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

7 participants