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: http data-datasource errors on 201 status code #12987

Closed
hegerdes opened this issue May 20, 2024 · 2 comments · Fixed by #12989
Closed

bug: http data-datasource errors on 201 status code #12987

hegerdes opened this issue May 20, 2024 · 2 comments · Fixed by #12989

Comments

@hegerdes
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

The packer http data-source errors on any non 200 status codes. Including 201 which is still a valid and successful response.

Reproduction Steps

Create a http data-source and request a backend that returns any 2xx status code except 200. Packer will fail

Packer version

Packer v1.10.3

Simplified Packer Template

data "http" "customizations_id" {
  url = "https://example.com"

  request_headers = {
    Accept = "application/json"
  }
}

Operating system and Environment details

Win 11 Pro, amd64

Log Fragments and crash.log files

Toggle me!
2024/05/20 16:36:22 [INFO] Packer version: 1.10.3 [go1.20.12 windows amd64]
2024/05/20 16:36:22 [TRACE] discovering plugins in C:\Users\Henrik\Tools
2024/05/20 16:36:22 [TRACE] discovering plugins in .
2024/05/20 16:36:22 [TRACE] discovering plugins in C:\Users\Henrik\AppData\Roaming\packer.d\plugins
2024/05/20 16:36:22 [INFO] Discovered potential plugin: hcloud = C:\Users\Henrik\AppData\Roaming\packer.d\plugins\github.com\hashicorp\hcloud\packer-plugin-hcloud_v1.2.1_x5.0_windows_amd64.exe
2024/05/20 16:36:22 [INFO] Discovered potential plugin: hcloud = C:\Users\Henrik\AppData\Roaming\packer.d\plugins\github.com\hetznercloud\hcloud\packer-plugin-hcloud_v1.2.1_x5.0_windows_amd64.exe
2024/05/20 16:36:22 [INFO] Discovered potential plugin: hcloud = C:\Users\Henrik\AppData\Roaming\packer.d\plugins\github.com\hetznercloud\hcloud\packer-plugin-hcloud_v1.3.0_x5.0_windows_amd64.exe
2024/05/20 16:36:22 [INFO] Discovered potential plugin: hcloud = C:\Users\Henrik\AppData\Roaming\packer.d\plugins\github.com\hetznercloud\hcloud\packer-plugin-hcloud_v1.4.0_x5.0_windows_amd64.exe
2024/05/20 16:36:22 [INFO] found external [-packer-default-plugin-name-] builders from hcloud plugin
2024/05/20 16:36:22 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/05/20 16:36:22 [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\Henrik\AppData\Roaming\packer.config
2024/05/20 16:36:22 [WARN] Config file doesn't exist: C:\Users\Henrik\AppData\Roaming\packer.config
2024/05/20 16:36:22 [INFO] Setting cache directory: D:\dev\devops\gitops\infra\packer\talos\packer_cache
e: cannot determine if process is in background: Process background check error: not implemented yet
2024/05/20 16:36:22 [TRACE] listing potential installations for "github.com/hetznercloud/hcloud" that match ">= 1.3.0". plugingetter.ListInstallationsOptions{FromFolders:[]string{"C:\\Users\\Henrik\\Tools", ".", "C:\\Users\\Henrik\\AppData\\Roaming\\packer.d\\plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"windows", ARCH:"amd64", Ext:".exe", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0003fe780)}}}}
2024/05/20 16:36:22 [TRACE] version "v1.2.1" of file "C:\\Users\\Henrik\\AppData\\Roaming\\packer.d\\plugins\\github.com\\hetznercloud\\hcloud\\packer-plugin-hcloud_v1.2.1_x5.0_windows_amd64.exe" does not match constraint ">= 1.3.0"
2024/05/20 16:36:22 [TRACE] Found the following "github.com/hetznercloud/hcloud" installations: [{C:\Users\Henrik\AppData\Roaming\packer.d\plugins\github.com\hetznercloud\hcloud\packer-plugin-hcloud_v1.3.0_x5.0_windows_amd64.exe v1.3.0},{C:\Users\Henrik\AppData\Roaming\packer.d\plugins\github.com\hetznercloud\hcloud\packer-plugin-hcloud_v1.4.0_x5.0_windows_amd64.exe v1.4.0}]
2024/05/20 16:36:22 [INFO] found external [-packer-default-plugin-name-] builders from hcloud plugin
2024/05/20 16:36:22 [TRACE] validateValue: not active for talos_version, so skipping
2024/05/20 16:36:22 [TRACE] validateValue: not active for talos_extentions, so skipping
2024/05/20 16:36:22 [INFO] Starting internal plugin packer-datasource-null
2024/05/20 16:36:22 Starting plugin: C:\Users\Henrik\Tools\packer.exe []string{"C:\\Users\\Henrik\\Tools\\packer.exe", "plugin", "packer-datasource-null"}
2024/05/20 16:36:22 Waiting for RPC address for: C:\Users\Henrik\Tools\packer.exe
2024/05/20 16:36:22 packer.exe plugin: [INFO] Packer version: 1.10.3 [go1.20.12 windows amd64]
2024/05/20 16:36:22 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/05/20 16:36:22 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\Henrik\AppData\Roaming\packer.config
2024/05/20 16:36:22 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\Henrik\AppData\Roaming\packer.config
2024/05/20 16:36:22 packer.exe plugin: [INFO] Setting cache directory: D:\dev\devops\gitops\infra\packer\talos\packer_cache
2024/05/20 16:36:22 packer.exe plugin: args: []string{"packer-datasource-null"}
2024/05/20 16:36:22 packer.exe plugin: Plugin port range: [10000,25000]
2024/05/20 16:36:22 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2024/05/20 16:36:22 packer.exe plugin: Waiting for connection...
2024/05/20 16:36:22 Received tcp RPC address for C:\Users\Henrik\Tools\packer.exe: addr is 127.0.0.1:10000
2024/05/20 16:36:22 packer.exe plugin: Serving a plugin connection...
2024/05/20 16:36:22 [INFO] (telemetry) Starting datasource null
2024/05/20 16:36:22 [INFO] (telemetry) ending null
2024/05/20 16:36:22 [INFO] Starting internal plugin packer-datasource-null
2024/05/20 16:36:22 Starting plugin: C:\Users\Henrik\Tools\packer.exe []string{"C:\\Users\\Henrik\\Tools\\packer.exe", "plugin", "packer-datasource-null"}
2024/05/20 16:36:22 Waiting for RPC address for: C:\Users\Henrik\Tools\packer.exe
2024/05/20 16:36:22 packer.exe plugin: [INFO] Packer version: 1.10.3 [go1.20.12 windows amd64]
2024/05/20 16:36:22 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/05/20 16:36:22 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\Henrik\AppData\Roaming\packer.config
2024/05/20 16:36:22 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\Henrik\AppData\Roaming\packer.config
2024/05/20 16:36:22 packer.exe plugin: [INFO] Setting cache directory: D:\dev\devops\gitops\infra\packer\talos\packer_cache
2024/05/20 16:36:22 packer.exe plugin: args: []string{"packer-datasource-null"}
2024/05/20 16:36:22 packer.exe plugin: Plugin port range: [10000,25000]
2024/05/20 16:36:22 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2024/05/20 16:36:22 packer.exe plugin: Waiting for connection...
2024/05/20 16:36:22 Received tcp RPC address for C:\Users\Henrik\Tools\packer.exe: addr is 127.0.0.1:10000
2024/05/20 16:36:22 packer.exe plugin: Serving a plugin connection...
2024/05/20 16:36:22 [INFO] (telemetry) Starting datasource null
2024/05/20 16:36:22 [INFO] (telemetry) ending null
2024/05/20 16:36:22 [INFO] Starting internal plugin packer-datasource-http
2024/05/20 16:36:22 Starting plugin: C:\Users\Henrik\Tools\packer.exe []string{"C:\\Users\\Henrik\\Tools\\packer.exe", "plugin", "packer-datasource-http"}
2024/05/20 16:36:22 Waiting for RPC address for: C:\Users\Henrik\Tools\packer.exe
2024/05/20 16:36:22 packer.exe plugin: [INFO] Packer version: 1.10.3 [go1.20.12 windows amd64]
2024/05/20 16:36:22 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/05/20 16:36:22 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\Henrik\AppData\Roaming\packer.config
2024/05/20 16:36:22 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\Henrik\AppData\Roaming\packer.config
2024/05/20 16:36:22 packer.exe plugin: [INFO] Setting cache directory: D:\dev\devops\gitops\infra\packer\talos\packer_cache
2024/05/20 16:36:22 packer.exe plugin: args: []string{"packer-datasource-http"}
2024/05/20 16:36:22 packer.exe plugin: Plugin port range: [10000,25000]
2024/05/20 16:36:22 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2024/05/20 16:36:22 packer.exe plugin: Waiting for connection...
2024/05/20 16:36:22 Received tcp RPC address for C:\Users\Henrik\Tools\packer.exe: addr is 127.0.0.1:10000
2024/05/20 16:36:23 packer.exe plugin: Serving a plugin connection...
2024/05/20 16:36:23 [INFO] (telemetry) Starting datasource http
2024/05/20 16:36:23 [INFO] (telemetry) ending http

  on talos.pkr.hcl line 32:
  (source code not available)

2024/05/20 16:36:23 [INFO] (telemetry) Finalizing.
Error: Datasource.Execute failed: HTTP request error. Response code: 201

  on talos.pkr.hcl line 32:
  (source code not available)


2024/05/20 16:36:24 waiting for all plugin processes to complete...
2024/05/20 16:36:24 C:\Users\Henrik\Tools\packer.exe: plugin process exited
2024/05/20 16:36:24 C:\Users\Henrik\Tools\packer.exe: plugin process exited
2024/05/20 16:36:24 C:\Users\Henrik\Tools\packer.exe: plugin process exited

@lbajolet-hashicorp
Copy link
Contributor

Hi @hegerdes,

Thanks for reporting this one to us, I've opened PR to fix this, anything in the 2xx range should not be considered an error.

If merged soon, this will be part of the 1.11.x series which we'll release hopefully soon.
Once merged, there will be a nightly release of Packer by the next day (Americas/Eastern timeline), I suggest you take it for a spin in order to validate this is fixed.

Thanks again!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants