#Tyler
1 messages · Page 1 of 1 (latest)
Hello there
Hi!
Sounds like you are using Firebase?
yep. I'm not sure what the problem is. It says it's missing data but i sent the same code in python without using a cloud function and it worked just fine
Hmm I'm not super familiar with Firebase but you should just need to hit our Accounts create API and provide type and capabilities
What is the error specifically?
And can you share your code? I'm happy to help try to debug, though like I said I don't know much about Firebase
it first give the warning "request body is missing data", then the error "Invalid request, unable to process."
sure, do you just want a screen shot of it? i don't have it on github
If you can drop the relevant part here in text between three backticks that is best
like this
val thread = Thread {
try {
val url = URL("https://us-central1-ridefair3.cloudfunctions.net/createStripeAccount")
println("*****TRY")
val jsonObject = createJsonObject()
val connection = url.openConnection() as HttpsURLConnection
connection.requestMethod = "POST"
connection.setRequestProperty("Content-Type", "application/json")
connection.setRequestProperty("Content-Length", "${jsonObject.toString().toByteArray().size}")
connection.doOutput = true
val outputStream: OutputStream = connection.outputStream
val bw = BufferedWriter(OutputStreamWriter(outputStream))
Log.d("JSON", jsonObject.toString(2))
bw.write(jsonObject.toString())
bw.close()
connection.connect()
println("RESPONSE CODE!!!!!!!")
println(connection.responseCode)
} catch (e: Exception) {
println("***CATCH")
println(e.message)
}
}
thread.start()
}```
that's the kotlin code in android studio let me get the cloud function
Are you hitting the Stripe API at all?
Or is the issue calling your cloud function from the frontend?
I'm not sure. How could I tell?
Do you see any requests in your Stripe Dashboard?
console.log(JSON.stringify(data));
try {
const account = await stripe.accounts.create();
return account;
} catch (error) {
console.error(error);
throw new functions.https.HttpsError('internal', error.message);
}
});```
i do not
It sounds like the issue is just between your frontend/backend based on the error message
As that doesn't sound like our error message
Yeah okay
Have you tried doing a simpler cloud function where you just send some data to your cloud function and receive a response without the Stripe part?
That would be my recommendation to start with
Okay I'll try that
As this does sound to me like an issue with reaching your backend at all
It probably is. I'll give your suggestion a shot
do you see any obvious problems with that cloud function?
I don't but I'm really not super familiar with cloud functions in general.