auth0 / terraform-provider-auth0

The Auth0 Terraform Provider is the official plugin for managing Auth0 tenant configuration through the Terraform tool.
https://registry.terraform.io/providers/auth0/auth0/latest/docs
Mozilla Public License 2.0
164 stars 79 forks source link

Client creation suddenly no longer working with oauth2: "server_error" "callback is not a function" #944

Closed guineveresaenger closed 4 months ago

guineveresaenger commented 5 months ago

Checklist

Description

A test program that has been working up until this weekend suddenly started failing with the error oauth2: "server_error" "callback is not a function". No code was changed; the program suddenly stopped working as expected.

Expectation

I expected a Client resource to be created, as previously possible.

To be clear, this is something that suddenly stopped working, with no changes on our end to conviguration, variables, or code. It was working for the most recent provider version right up until some time a few days ago.

It would be great to have more insight on the particular error message as well.

Reproduction

Running terraform apply on the following example code:

provider "auth0" {
  domain         = <OUR_DOMAIN>
  client_id      = <OUR_ID>
  client_secret  = <OUR_SECRET>
}

# Create a new Auth0 client
resource "auth0_client" "my_client" {
  name                                = "Application - Acceptance Test"
  app_type                            = "non_interactive"
  custom_login_page_on                = true
  is_first_party                      = true
  oidc_conformant                     = false
  callbacks                           = ["https://example.com/callback"]
  allowed_origins                     = ["https://example.com"]
  allowed_logout_urls                 = ["https://example.com"]
  web_origins                         = ["https://example.com"]
  grant_types = [
    "authorization_code",
    "http://auth0.com/oauth/grant-type/password-realm",
    "implicit",
    "password",
    "refresh_token"
  ]
  client_metadata = {
    foo = "zoo"
  }
}

results in:

 auth0_client.my_client: Creating...
╷
│ Error: failed to send the request: Post "https://<OUR_DOMAIN>/api/v2/clients": oauth2: "server_error" "callback is not a function"
│ 
│   with auth0_client.my_client,
│   on auth0_client.tf line 18, in resource "auth0_client" "my_client":
│   18: resource "auth0_client" "my_client" {
│ 
╵

Auth0 Terraform Provider version

v1.2.0

Terraform version

v1.5.7

developerkunal commented 4 months ago

Hi @guineveresaenger,

I hope you're having a great day!

I attempted to replicate the error on my end, but I wasn't able to encounter it while using your resource configuration. Could you provide me with more information about the issue so that I can assist you further?

developerkunal commented 4 months ago

Hey @guineveresaenger,

I hope you're doing well today! I wanted to reach out and apologize for any confusion my last message might have caused. I truly want to make sure everything is clear and easy for you.

So, about the configuration you're using:

provider "auth0" {
  domain         = <OUR_DOMAIN>
  client_id      = <OUR_ID>
  client_secret  = <OUR_SECRET>
}

# Create a new Auth0 client
resource "auth0_client" "my_client" {
  name                                = "Application - Acceptance Test"
  app_type                            = "non_interactive"
  custom_login_page_on                = true
  is_first_party                      = true
  oidc_conformant                     = false
  callbacks                           = ["https://example.com/callback"]
  allowed_origins                     = ["https://example.com"]
  allowed_logout_urls                 = ["https://example.com"]
  web_origins                         = ["https://example.com"]
  grant_types = [
    "authorization_code",
    "http://auth0.com/oauth/grant-type/password-realm",
    "implicit",
    "password",
    "refresh_token"
  ]
  client_metadata = {
    foo = "zoo"
  }
}

It seems you're using <Domain> as the domain. My suggestion would be to take a look at your configuration to ensure everything is set up correctly.

Also, I just wanted to clarify something from my last message. In my previous comment, I mentioned that I'm unable to reproduce the issue you're experiencing. This is because I've ensured that the configuration on my end is correct. If you have any further questions or need assistance, please feel free to let me know. I'm here to help!