Skip to content

Dev Container web terminal not working (unmarshaling issue on agent) #556

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

Closed
mafredri opened this issue Apr 3, 2025 · 2 comments · Fixed by coder/coder#17330
Closed
Assignees

Comments

@mafredri
Copy link
Member

mafredri commented Apr 3, 2025

Web Terminal is not working jumping into the devcontainer due to devcontainer.json unmarshaling issue.

2025-04-03 15:54:12.885 [erro]  reconnecting-pty: reconnecting pty failed with attach error  remote=[fd7a:115c:a1e0:4fcc:936f:eee3:3160:4d8e]:30937  local=[fd7a:115c:a1e0:4f79:ab27:2909:8264:7d43]:2  message_id=4b45e782-ade2-4c62-ba08-861305bd28ae  connection_id=442fc409-e396-4f28-a68c-e171d8f3c367  container=inspiring_diffie  container_user="" ...
    error= get container env info:
               github.com/coder/coder/v2/agent/reconnectingpty.(*Server).handleConn
                   /home/runner/work/coder/coder/agent/reconnectingpty/server.go:193
             - read devcontainer remoteEnv:
               github.com/coder/coder/v2/agent/agentcontainers.EnvInfo
                   /home/runner/work/coder/coder/agent/agentcontainers/containers_dockercli.go:122
             - unmarshal devcontainer.metadata:
               github.com/coder/coder/v2/agent/agentcontainers.devcontainerEnv
                   /home/runner/work/coder/coder/agent/agentcontainers/containers_dockercli.go:196
             - json: cannot unmarshal string into Go struct field DevContainer.postCreateCommand of type dcspec.Command

This happened using the https://github.com/devcontainers/template-starter project.

@mafredri
Copy link
Member Author

mafredri commented Apr 3, 2025

Seems to be because quicktype isn't properly generating the types.

				"postCreateCommand": {
					"type": [
						"string",
						"array",
						"object"
					],
					// ...

The generated type Command struct doesn't have any custom JSON unmarshaling to handle the different types.

@mafredri
Copy link
Member Author

mafredri commented Apr 3, 2025

I think just removing --just-types-and-package from gen.sh might do the trick. But needs validation.

@mafredri mafredri assigned mafredri and unassigned defelmnq Apr 10, 2025
mafredri added a commit to coder/coder that referenced this issue Apr 10, 2025
#17330)

This change allows proper unmarshaling of `devcontainer.json` and will
no longer break EnvInfoer or the Web Terminal.

Fixes coder/internal#556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants