#Tyler

1 messages · Page 1 of 1 (latest)

upper bladeBOT
charred coyote
#

Hello there

lost lion
#

Hi!

charred coyote
#

Sounds like you are using Firebase?

lost lion
#

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

charred coyote
#

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

lost lion
#

it first give the warning "request body is missing data", then the error "Invalid request, unable to process."

lost lion
charred coyote
#

If you can drop the relevant part here in text between three backticks that is best

#

like this

lost lion
#
        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

charred coyote
#

Are you hitting the Stripe API at all?

#

Or is the issue calling your cloud function from the frontend?

lost lion
#

I'm not sure. How could I tell?

charred coyote
#

Do you see any requests in your Stripe Dashboard?

lost lion
#
    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

charred coyote
#

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

lost lion
#

Okay I'll try that

charred coyote
#

As this does sound to me like an issue with reaching your backend at all

lost lion
#

It probably is. I'll give your suggestion a shot

#

do you see any obvious problems with that cloud function?

charred coyote
#

I don't but I'm really not super familiar with cloud functions in general.