I'm using supabase 3.0 (can't upgrade due to reaso...
# supabase-kt
c
I'm using supabase 3.0 (can't upgrade due to reasons...) but I'm hitting an issue/difference between iOS and Android.
Copy code
val response =
  supabaseClient.functions.invoke("upload-image") {
    setBody(
      MultiPartFormDataContent(
        formData {
          append(
            "file",
            chosenPhoto!!,
            Headers.build {
              append(
                HttpHeaders.ContentType,
                "image/png"
              )
              append(
                HttpHeaders.ContentDisposition,
                "form-data; name=\"image\"; filename=\"upload.png\"",
              )
            })
        }
      )
    )
    contentType(ContentType.MultiPart.FormData)
  }
in both cases. the upload completes successfully because i can see the result on the backend (uploads into a storage bucket) but I do actually get an error on the ios side. 🔴 HTTP request to https://myapp.supabase.co/functions/v1/upload-image (POST) failed with message: Content-Length mismatch: expected 434 bytes, but received 514 bytes on Android. no error.
j
Did you try reproducing this with a custom Ktor Client? So just create a raw Http Client and do the same request, if there is still an error, it may be Ktor's fault
Or then you could ask in #C0A974TJ9
c
cool. will try that 🤞
i can look it up myself i guess, but does supabase pull in ktor transitively?
j
should, otherwise you wouldn't have these methods in
Functions#invoke()
c
updated iosMain.dependencies { implementation("io.ktor:ktor-client-cio") to client-native and now it works /shruggie
👍 1
i swear ktor is confusing because it says itll auto setup the right client engines on your behalf.