#thorwebdev-api

1 messages · Page 1 of 1 (latest)

spring comet
#

sounds like most likely you have some sort of proxy or firewall or hosting configuration for example that is blocking the outbound request entirely and probably returning some custom HTML page to the API caller

supple gale
#

In the same environment a customer creation call is working fine though

spring comet
#

ok, let me think for a bit

supple gale
#

e.g. this is the customer creation call from the exact same environment: req_DACUaqLjBxqmA6

spring comet
#

I note you're using restricted API keys, wouldn't surprise me if those just don't work for that LoginLink endpoint and return an obscure error, testing it now

supple gale
#

ah yes, good catch. let me test with the main secret key

spring comet
#

if you wrap the call to stripe.accounts.createLoginLink in a try catch and do

}catch(e){
 console.log(JSON.stringify(e))
}

what does that print?

supple gale
#

Same error with main sk_ key also.

#

That's the log from above. This is my code:

try {
    const loginLink = await stripe.accounts.createLoginLink('acct_1LZWJGPPxRBiNZOx')

    return new Response(JSON.stringify({ loginLink }), {
      headers: { ...corsHeaders, 'Content-Type': 'application/json' },
      status: 200,
    })
  } catch (error) {
    console.log(JSON.stringify(error, null, 2))
    return new Response(JSON.stringify({ error: error.message }), {
      headers: { ...corsHeaders, 'Content-Type': 'application/json' },
      status: 400,
    })
  }
#

Let me check if running it in Node vs deno yields a different response

spring comet
#

well my next step would be to use something like Wireshark/Charles and try to view the raw response if this is on a local machine. You could also try making the same call using direct Node HTTP functions instead of the stripe-node library and see if that works, if so perhaps there is a bug in the stripe-node library. I still think it's likely something in your environment like a firewall blocking the request.
Ultimately the only way to progress this is to try and see what exactly the library is attempting to parse and is choking on

supple gale
#

Thanks for the pointers, will give that a go. Can confirm that in a Node environment it's running fine. So likely Deno related. Will report back here if I can uncover more