coder / coder

Provision remote development environments via Terraform
https://coder.com
GNU Affero General Public License v3.0
7.38k stars 598 forks source link

`coder_app` breaks when `command = "..."` and `subdomain = true` #8758

Open ElioDiNino opened 11 months ago

ElioDiNino commented 11 months ago

Version: v0.27.1+65583ec

If you create a coder_app like the following, you get a 500 error from Coder.

Either support for subdomains with commands should be added or the Terraform provider should complain that subdomain = true isn't allowed when command is set. When setting the subdomain key to false (or removing it entirely) things work fine (apart from the URL not being a subdomain).

resource "coder_app" "keeper-commander" {
  agent_id     = coder_agent.main.id
  slug         = "keeper-commander"
  display_name = "Keeper CLI"
  icon         = "https://www.keepersecurity.com/assets/branding/android-icon-192x192.png"
  command      = "keeper shell"
  subdomain    = true
  share        = "owner"
}
Screenshot 2023-07-26 at 6 18 37 PM
sreya commented 11 months ago

@ElioDiNino would you mind adding the corresponding server log with the 500 error?

ElioDiNino commented 11 months ago

@ElioDiNino would you mind adding the corresponding server log with the 500 error?

2023-07-27 22:18:09.838 [warn]  coderd.workspaceapps: workspace app auth server error: get app details from database  request_id=7fd69c50-2b9e-4996-b749-ec4c27b5d3d5  username_or_id=redacted  workspace_and_agent=""  workspace_name_or_id=broken  agent_name_or_id=main  app_name_or_port=keeper-commander ...
    error= app URL is not valid:
               github.com/coder/coder/coderd/workspaceapps.Request.getDatabase
                   /home/runner/actions-runner/_work/coder/coder/coderd/workspaceapps/request.go:293
2023-07-27 22:18:09.839 [warn]  coderd: GET  host=keeper-commander--main--broken--redacted.coder.redacted.local  path=/  proto=HTTP/2.0  remote_addr=240.15.124.128  took=10.503439ms  status_code=500  latency_ms=10  request_id=7fd69c50-2b9e-4996-b749-ec4c27b5d3d5 ...
    response_body= ">Back to site</a>
                         </div>
                       </div>
                     </body>
                   </html>
2023-07-27 22:18:09.870 [warn]  coderd.workspaceapps: workspace app auth server error: get app details from database  request_id=8815e9a8-1171-4064-ac5e-80903525fa5b  username_or_id=redacted  workspace_and_agent=""  workspace_name_or_id=broken  agent_name_or_id=main  app_name_or_port=keeper-commander ...
    error= app URL is not valid:
               github.com/coder/coder/coderd/workspaceapps.Request.getDatabase
                   /home/runner/actions-runner/_work/coder/coder/coderd/workspaceapps/request.go:293
2023-07-27 22:18:09.870 [warn]  coderd: GET  host=keeper-commander--main--broken--redacted.coder.redacted.local  path=/favicon.ico  proto=HTTP/2.0  remote_addr=240.15.124.128  took=10.124058ms  status_code=500  latency_ms=10  request_id=8815e9a8-1171-4064-ac5e-80903525fa5b ...
    response_body= ">Back to site</a>
                         </div>
                       </div>
                     </body>
                   </html>
bpmct commented 11 months ago

Thanks for reporting. We should change the Terraform provider to not support subdomain=true and command properties.

matifali commented 7 months ago

@bpmct and @sreya, why the command can not work when subdomain=true? Is there a technical limitation?