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

receieved "error reading from server" while trying to refresh #1189

Closed
4 tasks done
madelaney opened this issue Feb 6, 2025 · 2 comments · Fixed by #1190
Closed
4 tasks done

receieved "error reading from server" while trying to refresh #1189

madelaney opened this issue Feb 6, 2025 · 2 comments · Fixed by #1190
Assignees
Labels
bug Something isn't working

Comments

@madelaney
Copy link

madelaney commented Feb 6, 2025

Describe the bug
While trying to remove a (git-lfs) repository from Artifactory via the terraform provider, I started to receive the message:

│ Error: Unable to Refresh Resource
│
│ An unexpected error occurred while attempting to refresh resource state. Please retry the operation or report this issue to the provider developers.
│
│ Error: Bad Request

If I enable TF_LOG I see the following:

2025-02-06T15:57:57.080-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2025-02-06T15:57:57.080-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2025-02-06T15:57:57.081-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/jfrog/platform/1.19.1/darwin_arm64/terraform-provider-platform_v1.19.1 pid=56367
2025-02-06T15:57:57.081-0500 [DEBUG] provider: plugin exited
2025-02-06T15:57:57.081-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/jfrog/artifactory/12.8.0/darwin_arm64/terraform-provider-artifactory_v12.8.0 pid=56368
2025-02-06T15:57:57.081-0500 [DEBUG] provider: plugin exited

Artifactory version:

jf rt curl api/system/version
{
  "version" : "7.98.14",
  "revision" : "79814900",
  "servicesVersions" : {
    "package_handler_version" : ""
  },
  "addons" : [ "build", "docker", "helmoci", "oci", "packages-archive", "vagrant", "replication", "filestore", "curation", "plugins", "worker", "gems", "composer", "npm", "bower", "nuget", "debian", "opkg", "rpm", "cocoapods", "conan", "vcs", "release-bundle", "jf-connect", "jf-event", "replicator", "keys", "alpine", "analytics", "cargo", "chef", "federated", "git", "observability", "onboarding", "pub", "rest", "swift", "lead-artifact-detector", "conda", "terraform", "tracker", "license", "puppet", "ldap", "sso", "layouts", "properties", "search", "securityresourceaddon", "filtered-resources", "p2", "watch", "webstart", "support", "xray", "retention", "policies", "archive" ],
  "license" : "03b04c9dc2fa519251bec2725a7506099c7a86732",
  "entitlements" : {
    "EVENT_BASED_PULL_REPLICATION" : false,
    "SMART_REMOTE_TARGET_FOR_EDGE" : false,
    "REPO_REPLICATION" : true,
    "MULTIPUSH_REPLICATION" : false
  }
}

Terraform Version:

tf version
Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/null v3.2.3
+ provider registry.terraform.io/hashicorp/random v3.6.3
+ provider registry.terraform.io/jfrog/artifactory v12.8.0
+ provider registry.terraform.io/jfrog/platform v1.19.1

Your version of Terraform is out of date! The latest version
is 1.10.5. You can update by downloading from https://www.terraform.io/downloads.html

Requirements for and issue

  • A description of the bug
  • [-] A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue). If this is not supplied, this issue will likely be closed without any effort expended.
  • Your version of artifactory (you can curl it at $host/artifactory/api/system/version
  • Your version of terraform
  • Your version of terraform provider

Expected behavior
This is from a terraform refresh, I would expect this to update the local state file.

Additional context
N/A

@madelaney madelaney added the bug Something isn't working label Feb 6, 2025
@alexhung
Copy link
Member

alexhung commented Feb 6, 2025

@madelaney Thanks for the report! I've added this to our plan to investigate and fix.

Can you share a sample of your TF configuration for this repo? So far I have not been able to reproduce this issue.

@madelaney
Copy link
Author

madelaney commented Feb 7, 2025

@alexhung , I'll was trying to get one for you but I think this was actually a result of a corrupted terraform state file.

I say that because while debugging further, I found this log entry:

2025-02-07T07:46:23.589-0500 [ERROR] provider.terraform-provider-artifactory_v12.8.0: Response contains error diagnostic: tf_req_id=9e1f8df4-5ffa-4191-960b-e4e8ff7b5ab1 @caller=github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov6/internal/diag/diagnostics.go:58 diagnostic_detail="An unexpected error occurred while attempting to refresh resource state. Please retry the operation or report this issue to the provider developers.

Error: Bad Request" tf_proto_version=6.7 tf_provider_addr=jfrog/artifactory @module=sdk.proto diagnostic_severity=ERROR diagnostic_summary="Unable to Refresh Resource" tf_resource_type=artifactory_local_gitlfs_repository tf_rpc=ReadResource timestamp=2025-02-07T07:46:23.589-0500
2025-02-07T07:46:23.589-0500 [ERROR] vertex "artifactory_local_gitlfs_repository.git-lfs-local" error: Unable to Refresh Resource
2025-02-07T07:46:23.589-0500 [ERROR] vertex "artifactory_local_gitlfs_repository.git-lfs-local (expand)" error: Unable to Refresh Resource

The repo (git-lfs-local) did exist, but was deleted in a previous run of terraform, however that change to delete the repository didn't seem to get committed to the terraform state file so runs of terraform plan were trying to refresh a state of a repository that had been deleted.

I manually created the repo in artifactory, then re-ran terraform plan and it showed that this repo was marked for deletion. This seems like an odd bug.

I was able to create a some steps to reproduce (this is not how I got the error originally but this is how I can reproduce the error message):

  1. run terraform code at https://gist.github.com/madelaney/8fca799a78ba37de08ec3c4f42913d54
  2. in artifactory, delete the newly created repository
  3. run any terraform plan or terraform apply

I should also note that if I remove the stanza that creates the repository the error does not go away. The only way for me to clear the error is to manually create the repository in artifactory or use terraform state rm to remove the object references.

alexhung added a commit that referenced this issue Feb 11, 2025
…sing-repo

Fix unable to refresh missing repo
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

Successfully merging a pull request may close this issue.

3 participants