#Cavalaa
1 messages · Page 1 of 1 (latest)
Hi 👋 I've created a thread, can you put your other context here?
Hm, can you share the code that is creating that request?
Also, that does appear to be logs for a POST request, can you confirm that request received the error you referenced?
heres the request headers
const visitAccountLink = async (e) => {
var myHeaders = new Headers()
myHeaders.append('Content-Type', 'application/x-www-form-urlencoded')
myHeaders.append('Authorization', 'Bearer ' + stripeToken)
var urlencoded = new URLSearchParams()
urlencoded.append(
'refresh_url',
process.env.NEXT_PUBLIC_AUTH_URL + 'cash-out'
)
urlencoded.append(
'return_url',
process.env.NEXT_PUBLIC_AUTH_URL + 'cash-out'
)
urlencoded.append('account', accountID)
urlencoded.append('type', 'account_onboarding')
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow',
}
fetch('https://api.stripe.com/v1/account_links', requestOptions)
.then((response) => response.text())
.then((result) => {
let jsonRes = JSON.parse(result)
window.location.href = jsonRes.url
})
.catch((error) => console.log('error', error))
}
here's the only function that makes the request
Is this client-side code, or server-side code?
this is the frontend code, the backend code makes no API calls
How are you doing that, is your secret key in your frontend code?
You shouldn't be sending your secret key to your frontend.
That exposes it, and anyone with that key can make requests for your account.
yeah that's a great point, how should you hide it?
By keeping it on your server, and using it from your server side code.
ok, that's something to get sorted, but in the meantime how do I sort this error message I'm getting
Personally I would suggest prioritizing refactoring your code so these requests are made from a server, I wouldn't anticipate this error continuing to be faced when creating Account Links from your server.
I'm not sure what is causing that error offhand, and it doesn't look like it created a request ID so I would have a hard time locating that on our end. I saw in your screenshot that some of the requests succeed, are you able to spot any difference between them? Are they being triggered by the same code?
Idempotency-Key:
3f7f190e-8ea5-455d-a562-3c8ca3a74b38
Original-Request:
req_Gm7mI7lmEqDfgp
Request-Id:
req_Gm7mI7lmEqDfgp
Server:
nginx
Strict-Transport-Security:
max-age=63072000; includeSubDomains; preload
Stripe-Should-Retry:
false
The failed attempt has the above in the response headers where the other request has nothing
That is showing as a POST request on our side. Have you checked the error returned in that response via the Stripe dashboard?
https://dashboard.stripe.com/logs/req_Gm7mI7lmEqDfgp
It gives me the impression that there are branding settings which need to be configured.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
ah there it is, I'm getting a few settings we're missing on our end, let me see if that fixed it, thanks!
Any time!