Problem
Trying to add a Private registry module via the API (without VCS connection) to TFE responds with "OK".
All API calls return OK status codes (2xx) however, the TFE UI shows "setup failed" against the module in the registry.
- Clicking that link yields a page that shows the available version listed as "OK".
- Clicking on any of the versions returns a 500 response.
Cause
The payload.json
version included the letter "v".
"{
"data": {
"type": "registry-module-versions",
"attributes": {
"version": "v1.2.3"
}
}
}
Intfe-registry-api
logs, the following error is observed.
ERROR: invalid input syntax for integer: "v0" (SQLSTATE 22P02)
2022-11-01T09:52:13.078869000Z [1.986ms] [rows:0] SELECT version FROM (SELECT *, regexp_split_to_array("version", '(\.|-|\+)')
as v FROM "module_versions" WHERE module_provider_id IN (1051)) as versions ORDER BY versions.v[1:3]::bigint[],NULLIF(versions.v[4:array_upper(versions.v,1)], '{}') NULLS LAST
2022-11-01T09:52:13.079297000Z 2022-11-01T09:52:13.077Z [ERROR] Error loading module versions: 2022-11-01T09:52:13.079781000Z error= 2022-11-01T09:52:13.080184000Z | {*multierror.Error 1 error occurred:
2022-11-01T09:52:13.080651000Z | * ERROR: invalid input syntax for integer: "v0" (SQLSTATE 22P02)
Solutions:
Fix payload.json
file to remove the "v" wrongly placed in the version value and remove the module entirely from the UI. Finally, re-publish it with the correct payload.json
.
{
"data": {
"type": "registry-module-versions",
"attributes": {
"version": "1.2.3"
}
}
}
Additional Information
- A bug is filed with HashiCorp to fix the problem in future TFE releases.