Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth0 connection fails with "no Host in request URL" #1023

Closed
6 tasks done
VenelinMartinov opened this issue Sep 11, 2024 · 6 comments
Closed
6 tasks done

Auth0 connection fails with "no Host in request URL" #1023

VenelinMartinov opened this issue Sep 11, 2024 · 6 comments
Assignees
Labels
🪲 bug Something isn't working

Comments

@VenelinMartinov
Copy link

Checklist

  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have upgraded to the latest version of this provider and the issue still persists.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

Trying to create an auth0_connection fails with:

│ Error: failed to send the request: Post "https://api/v2/connections": Post "https:/oauth/token": http: no Host in request URL

Expectation

It succeeds or produces a meaningful error.

Reproduction

terraform {
  required_providers {
    auth0 = {
      source  = "auth0/auth0"
      version = "1.6.1"
    }
  }
}

provider "auth0" {
}

resource "auth0_connection" "google_oauth_2" {
  name     = "my_connection"
  strategy = "google-oauth2"

  options {
    client_id              = "xxxxxxxxxxxxxx"
    client_secret          = "xxxxxxxxxxxxxxxx"
    set_user_root_attributes = "on_each_login"
  }
}

run terraform apply

Auth0 Terraform Provider version

1.6.1

Terraform version

v1.9.5

@duedares-rvj
Copy link
Contributor

Hello.
Have you setup the environment variables?
Because your POST request is without appropriate domain

Ref: CONTRIBUTING.md
https://github.com/auth0/terraform-provider-auth0/blob/main/CONTRIBUTING.md?plain=1#L73

@duedares-rvj duedares-rvj self-assigned this Sep 12, 2024
@VenelinMartinov
Copy link
Author

Hey @duedares-rvj, thanks for the suggestion.
No, I hadn't set up the environment variables and that was indeed the problem.

Should the provider give a better error message when this happens? Seems like a common enough issue, in this case with my configuration (I use a separate layer for credentials, which was not configured correctly).

@duedares-rvj
Copy link
Contributor

@VenelinMartinov Hello again.
I'm really sorry if the error reporting was not adequate. Although, we have tried to best highlight the configuration setup as the very first step:
https://registry.terraform.io/providers/auth0/auth0/latest/docs

Let us know if there is anything further that we can add to improve the experience.
Thank you.

@VenelinMartinov
Copy link
Author

Hey @duedares-rvj thanks for the response!

Would it make sense for the provider itself to check that it is configured correctly and print an error message if not?

In my case, I was fully aware of he need to configure it but due to a type it was not configured correctly.

@duedares-rvj
Copy link
Contributor

@VenelinMartinov I have added an explicit check for this. Hope that helps. Thanks.

@VenelinMartinov
Copy link
Author

Thanks @duedares-rvj!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants