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

Doesn't work with bun, no cookies emitted or captured #692

Closed
Thinkscape opened this issue Nov 23, 2023 · 3 comments
Closed

Doesn't work with bun, no cookies emitted or captured #692

Thinkscape opened this issue Nov 23, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Thinkscape
Copy link
Contributor

Thinkscape commented Nov 23, 2023

Describe the bug

When run with bun as runtime, doesn't seem to include nor parse cookies.
Tested with global fetch and axios.

To Reproduce

Steps to reproduce the behavior:

  1. Run the examples from this repo or https://github.com/3846masa/axios-cookiejar-support
  2. Send a request which responds with set-cookie headers.
  3. Send another request

Expected behavior

The cookie jar has cookies. The second request sends them back

Actual behaviour

Cookie jar is empty.
Second request has no cookie header.

Setting cookies manually with jar.setCookieSync(...) between requests, then sending second request still results in second request not containing cookie header 🤔

Repro

const jar = new CookieJar(undefined, {
// -- Tried all of those, didn't help
//  looseMode: true,
//  prefixSecurity: "unsafe-disabled",
//  rejectPublicSuffixes: false,
//  allowSpecialUseDomain: true,
});
const client = wrapper(axios.create({jar }));

await client.get('https://some.site');
console.log(jar.toJSON());
bun run example.ts

Environments

  • OS: macos
  • Bun version: 1.0.12
  • axios version: 1.6.1
  • tough-cookie version: 4.1.3
@Thinkscape Thinkscape added the bug Something isn't working label Nov 23, 2023
@Thinkscape Thinkscape changed the title doesn't work with bun Doesn't work with bun, no cookies emitted or captured Nov 23, 2023
@Thinkscape
Copy link
Contributor Author

Tried with got, but it's got other problems that prevent it from running. Given that bun has its own fetch implementation, that might be what's causing trouble. See oven-sh/bun#4395

@3846masa
Copy link
Owner

Thank you for reporting the issue.

The http-cookie-agent relies on undici, the internal implementation of fetch in Node.js.
Therefore, it will not work with any fetch implementation other than Node.js.

I would like to make it work with fetch implementations other than Node.js in the future, but there is no plan yet.

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 28, 2023
@3846masa 3846masa removed the stale label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants