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

[BUG]: Unable to enter anonymous mode as such fail with 401 #2014

Closed
1 task done
duxbuse opened this issue Nov 13, 2023 · 7 comments
Closed
1 task done

[BUG]: Unable to enter anonymous mode as such fail with 401 #2014

duxbuse opened this issue Nov 13, 2023 · 7 comments
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@duxbuse
Copy link

duxbuse commented Nov 13, 2023

Expected Behavior

In v5.32.0 I can easily provide no token and it correctly enters anonymous mode and fetches files from a public repository.

I expected the same in later versions.

WORKING

[DEBUG] provider: using plugin: version=5
[DEBUG] No provider meta schema returned
[WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/integrations/github\"]" changed the config value, but that value is unused
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [INFO] Selecting owner  from GITHUB_OWNER environment variable
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [INFO] Setting write_delay_ms to 1000
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [DEBUG] Setting read_delay_ms to 0
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [DEBUG] Setting parallel_requests to false
[DEBUG] provider.terraform-provider-github_v5.32.0: 2023/11/13 12:26:16 [INFO] No token present; configuring anonymous owner.

Actual Behavior

In V5.42.0 it doesnt enter anonymous mode and then tries to authenticate to the v3/user API and fails with a http 401 response.

BROKEN

[DEBUG] provider: using plugin: version=5
[DEBUG] No provider meta schema returned
[WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/integrations/github\"]" changed the config value, but that value is unused
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [INFO] Selecting owner  from GITHUB_OWNER environment variable
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [INFO] Setting write_delay_ms to 1000
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] Setting read_delay_ms to 0
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] Setting parallel_requests to false
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] GitHub API Request Details:
[DEBUG] provider.terraform-provider-github_v5.42.0: ---[ REQUEST ]---------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: GET /api/v3/user HTTP/1.1
[DEBUG] provider.terraform-provider-github_v5.42.0: Host: github.***.com
[DEBUG] provider.terraform-provider-github_v5.42.0: User-Agent: go-github/v55.0.0
[DEBUG] provider.terraform-provider-github_v5.42.0: Accept: application/vnd.github.v3+json,application/vnd.github.stone-crop-preview+json
[DEBUG] provider.terraform-provider-github_v5.42.0: X-Github-Api-Version: 2022-11-28
[DEBUG] provider.terraform-provider-github_v5.42.0: Accept-Encoding: gzip
[DEBUG] provider.terraform-provider-github_v5.42.0
[DEBUG] provider.terraform-provider-github_v5.42.0
[DEBUG] provider.terraform-provider-github_v5.42.0: -----------------------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] GitHub API Response Details:
[DEBUG] provider.terraform-provider-github_v5.42.0: ---[ RESPONSE ]--------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: HTTP/2.0 401 Unauthorized

Terraform Version

Terraform v1.6.2
on linux_amd64

  • provider registry.terraform.io/hashicorp/google v5.5.0
  • provider registry.terraform.io/hashicorp/google-beta v5.5.0
  • provider registry.terraform.io/hashicorp/null v3.2.1
  • provider registry.terraform.io/hashicorp/random v3.5.1
  • provider registry.terraform.io/hashicorp/time v0.9.1
  • provider registry.terraform.io/integrations/github v5.42.0

Affected Resource(s)

  • github_repository_file

Terraform Configuration Files

# backend+provider.tf

provider "github" {
  base_url = "https://github.***.com/"
}

Steps to Reproduce

terraform plan

Debug Output

[DEBUG] provider: using plugin: version=5
[DEBUG] No provider meta schema returned
[WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/integrations/github\"]" changed the config value, but that value is unused
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [INFO] Selecting owner  from GITHUB_OWNER environment variable
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [INFO] Setting write_delay_ms to 1000
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] Setting read_delay_ms to 0
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] Setting parallel_requests to false
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] GitHub API Request Details:
[DEBUG] provider.terraform-provider-github_v5.42.0: ---[ REQUEST ]---------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: GET /api/v3/user HTTP/1.1
[DEBUG] provider.terraform-provider-github_v5.42.0: Host: github.***.com
[DEBUG] provider.terraform-provider-github_v5.42.0: User-Agent: go-github/v55.0.0
[DEBUG] provider.terraform-provider-github_v5.42.0: Accept: application/vnd.github.v3+json,application/vnd.github.stone-crop-preview+json
[DEBUG] provider.terraform-provider-github_v5.42.0: X-Github-Api-Version: 2022-11-28
[DEBUG] provider.terraform-provider-github_v5.42.0: Accept-Encoding: gzip
[DEBUG] provider.terraform-provider-github_v5.42.0
[DEBUG] provider.terraform-provider-github_v5.42.0
[DEBUG] provider.terraform-provider-github_v5.42.0: -----------------------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: 2023/11/13 12:35:45 [DEBUG] GitHub API Response Details:
[DEBUG] provider.terraform-provider-github_v5.42.0: ---[ RESPONSE ]--------------------------------------
[DEBUG] provider.terraform-provider-github_v5.42.0: HTTP/2.0 401 Unauthorized

Panic Output

│ Error: GET https://github.***.com/api/v3/user: 401 Requires authentication []
│ 
│   with provider["registry.terraform.io/integrations/github"],
│   on backend+provider.tf line 58, in provider "github":
│   58: provider "github" {

Code of Conduct

  • I agree to follow this project's Code of Conduct
@duxbuse duxbuse added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Nov 13, 2023
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@nickfloyd nickfloyd moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Nov 13, 2023
@nickfloyd nickfloyd added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Nov 13, 2023
@albertorm95
Copy link

Same here

@czachow
Copy link

czachow commented Nov 16, 2023

We experience the same problem

@kfcampbell
Copy link
Member

The cause of this is #1029. Do we think it's worth rolling back? Ideally, we'd roll forward to a version that doesn't call "/user" when no token is present.

@smittnacht
Copy link

Also affected by this, therefore sticking with v5.40.0 for now

kfcampbell added a commit that referenced this issue Jan 5, 2024
Resolves regressions #2008 and #2014 introduced in #1029

Signed-off-by: Marco Nenciarini <[email protected]>
Co-authored-by: Keegan Campbell <[email protected]>
@mnencia
Copy link
Contributor

mnencia commented Jan 11, 2024

This should be solved in release 5.44.0.

@duxbuse can you please confirm?

@duxbuse
Copy link
Author

duxbuse commented Jan 15, 2024

@mnencia 5.44.0 is working great, thanks.

@duxbuse duxbuse closed this as completed Jan 15, 2024
@github-project-automation github-project-automation bot moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Active Jan 15, 2024
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this issue Feb 5, 2024
Resolves regressions integrations#2008 and integrations#2014 introduced in integrations#1029

Signed-off-by: Marco Nenciarini <[email protected]>
Co-authored-by: Keegan Campbell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

7 participants