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

No HTTP proxy support #35

Closed
Nevon opened this issue Mar 29, 2023 · 3 comments
Closed

No HTTP proxy support #35

Nevon opened this issue Mar 29, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Nevon
Copy link

Nevon commented Mar 29, 2023

The PineconeClient doesn't expose any of the options by the underlying API client, which means there's no way to configure it to use an HTTP proxy, or more generally control the behavior of the HTTP client, such as keep-alive. This makes it difficult to use in controlled environments.

The generated api client exposes a fetchApi option where you can supply a fetch-compatible implementation, where you could inject such functionality. Unfortunately the native fetch API doesn't support node's Agent interface, so you'd have to swap it out and do some mapping, but at least it's possible. Something like:

import undici, { RequestInit, ProxyAgent } from 'undici'

const dispatcher = new ProxyAgent(process.env.HTTPS_PROXY!)
const configuration = {
  environment,
  apiKey,
  fetch: async (input: string | URL, init?: RequestInit) => {
    return undici.fetch(input, { ...init, dispatcher })
  }
}
await client.init(configuration)

An example of another API client that I think is generated using the same tooling that you are using, which does support this, is the Adobe Target SDK

@rschwabco rschwabco added enhancement New feature or request help wanted Extra attention is needed labels Mar 29, 2023
@gdj0nes
Copy link
Collaborator

gdj0nes commented Mar 30, 2023

@Nevon thanks for the feedback! We'll definitely looking into and look into how we can support use cases like yours.

@jhamon jhamon self-assigned this Sep 15, 2023
@aulorbe
Copy link
Collaborator

aulorbe commented Aug 27, 2024

Hey @Nevon just wanted to chime in and say that this is on my to-do list for the upcoming quarter or two! We haven't forgotten about you :)

@aulorbe aulorbe assigned aulorbe and unassigned jhamon Aug 27, 2024
@aulorbe
Copy link
Collaborator

aulorbe commented Sep 25, 2024

Hey all, proxy support is enabled in the client. Now, see the README for instructions.

@aulorbe aulorbe closed this as completed Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants