#gris_code

1 messages ยท Page 1 of 1 (latest)

kind craterBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1215624852959006740

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

vocal trailBOT
frank quiver
#

hi! hmm I've never used Deno unfortunately but httpAgent is the right parameter in general yes for our library. Did it not work/did you get some kind of error?

reef turtle
#

Hi @frank quiver !
Yes I received theis one "Error: Stripe: createNodeHttpClient() is not available in non-Node environments. Please use createFetchHttpClient() instead."

#

So i use the createFetchHttpClient() Like so :
/**

  • httpClient: createFetchHttpClient -> Deno.createHttpClient
  • Error: An error occurred with our connection to Stripe. Request was retried 1 times.
    */
    const stripe = new Stripe(rak, {
    apiVersion,
    typescript: true,
    maxNetworkRetries: 1,
    httpClient: Stripe.createFetchHttpClient(() => {
    return fetch(${stripeApiUrl}, {
    client: Deno.createHttpClient({
    proxy: {
    url: proxyUrl,
    },
    }),
    });
    }),
    timeout: 1000,
    telemetry: true,
    });
#

Then I tried this :
/**

  • httpAgent + httpClient -> createFetchHttpClient sans config fetch
  • Error: The API key provided does not allow requests from your IP address.
    */
    const stripeApiUrl = 'https://api.stripe.com'
    const httpAgentInstance = new HttpsProxyAgent(proxyUrl)
    const stripe = new Stripe(rak, {
    apiVersion,
    typescript: true,
    maxNetworkRetries: 1,
    httpAgent: httpAgentInstance,
    httpClient: Stripe.createFetchHttpClient(),
    timeout: 1000,
    telemetry: true,
    })
frank quiver
#

note there are specific steps to use the library with Deno, are you doing those?

#

Error: The API key provided does not allow requests from your IP address.
ok well that's a different thing and easily fixed

reef turtle
#

I'm currently working on an edge function of Supabase
The Stripe SDK worked properly with the classic creation, and the webhook too.
My problem is that I try to use the SDK with a restricted key. I arlready create the key with the fixe IP.
I test on a nodejs environment and there is no problem :/

frank quiver
#

to be clear do you need a proxy? And a restricted key is a separate concept from a proxy, they're not related

kind craterBOT
reef turtle
#

Yes I need the proxy because the IP address of the edge function can change. The proxy give me the fix IP.
And I need to access to sensible data, to do so Stripe force me to enter an IP address.

I already do the trick on a nodejs project, deploy on Heroku, and it's worked.

frank quiver
#

can you just remove the IP restriction in Stripe?

#

oh no you can't because it's a Identity requirement, ugh.

reef turtle
#

I can't its mandatory to get the 'Access all detailed verification results' from Stripe.Identity

frank quiver
#

I hate that that's a requirement, sorry.

reef turtle
#

Me too ๐Ÿ˜„

frank quiver
#

well to me anyway the correct approach should be what you have here

const httpAgentInstance = new HttpsProxyAgent(proxyUrl)
      const stripe = new Stripe(rak, {
          apiVersion,
          typescript: true,
          maxNetworkRetries: 1,
          httpAgent: httpAgentInstance,
          httpClient: Stripe.createFetchHttpClient(),
          timeout: 1000,
          telemetry: true,})
#

if the error that gives you is ' The API key provided does not allow requests from your IP address.' then you probably need to make sure your proxy's outgoing IP is actually properly entered in the Stripe dashboard for the API key you're using.

#

or if you think the problem is that the library is ignoring the proxy(?) then maybe it's some bug and you could open an issue on stripe-node, you're probably the first person to use Deno + a proxy with our library to be honest.