jpedroh / terraform-provider-turso

Mozilla Public License 2.0
4 stars 2 forks source link

Unable to create database, got error: decode response: unexpected Content-Type: text/plain #17

Open ricardogomes opened 5 months ago

ricardogomes commented 5 months ago

I'm getting this error with the following elements:

Unable to create database, got error: decode response: unexpected Content-Type: text/plain

terraform {
  required_providers {
     turso = {
      source = "jpedroh/turso"
      version = "0.2.0"
    }
  }
}

provider "turso" {
  api_token = "<TOKEN>"
}
resource "turso_database" "testing" {
  organization_name = "<MY_ORG>"
  group             = "default"
  name              = "testing"
}

The <> are replaced with actual values

ainsleyclark commented 3 months ago

Same here

Unable to create database, got error: decode response: unexpected Content-Type: text/plain

@jpedroh any ideas?

jpedroh commented 3 months ago

Hello!

Sorry for taking so long to answer this, been busy with a few side things.

I've analyzed it a little and somehow, the API for Turso started randomly returning Content Type text-plain for valid JSON. This then breaks the behaviour of the autogenerated swagger client. I'm thinking in opening a PR for forcing the response content type to be application/json so the api response parse do not fail

jpedroh commented 3 months ago

Ok I've updated the swagger definitions and gave it a try and it seems to be working. Can you guys give a try? I've published a new version 0.2.1.