Skip to content

Error Creating Sandbox with daytona_sdk Due to Parameter Mismatch #1760

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
garenchan opened this issue Apr 24, 2025 · 1 comment
Closed

Error Creating Sandbox with daytona_sdk Due to Parameter Mismatch #1760

garenchan opened this issue Apr 24, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@garenchan
Copy link

Describe the bug
I tried to deploy Daytona locally and then create a sandbox using daytona_sdk, but it failed with the following error:

daytona_sdk.common.errors.DaytonaError: Failed to create sandbox: {"error":"Key: 'CreateWorkspaceDTO.Id' Error:Field validation for 'Id' failed on the 'required' tag\nKey: 'CreateWorkspaceDTO.Name' Error:Field validation for 'Name' failed on the 'required' tag\nKey: 'CreateWorkspaceDTO.Source' Error:Field validation for 'Source' failed on the 'required' tag\nKey: 'CreateWorkspaceDTO.EnvVars' Error:Field validation for 'EnvVars' failed on the 'required' tag\nKey: 'CreateWorkspaceDTO.Labels' Error:Field validation for 'Labels' failed on the 'required' tag\nKey: 'CreateWorkspaceDTO.TargetId' Error:Field validation for 'TargetId' failed on the 'required' tag"}

I checked the source code and found that the parameters in the latest code of Daytona are inconsistent with those used in the daytona_api_client of daytona_sdk, as follows:

// pkg/services/workspace.go:39
type CreateWorkspaceDTO struct {
	Id                  string                   `json:"id" validate:"required"`
	Name                string                   `json:"name" validate:"required"`
	Image               *string                  `json:"image,omitempty" validate:"optional"`
	User                *string                  `json:"user,omitempty" validate:"optional"`
	BuildConfig         *models.BuildConfig      `json:"buildConfig,omitempty" validate:"optional"`
	Source              CreateWorkspaceSourceDTO `json:"source" validate:"required"`
	EnvVars             map[string]string        `json:"envVars" validate:"required"`
	Labels              map[string]string        `json:"labels" validate:"required"`
	TargetId            string                   `json:"targetId" validate:"required"`
	GitProviderConfigId *string                  `json:"gitProviderConfigId,omitempty" validate:"optional"`
} //	@name	CreateWorkspaceDTO
# daytona_api_client-0.17.1/daytona_api_client/models/create_workspace.py:25
class CreateWorkspace(BaseModel):
    """
    CreateWorkspace
    """ # noqa: E501
    image: Optional[StrictStr] = Field(default=None, description="The image used for the workspace")
    user: Optional[StrictStr] = Field(default=None, description="The user associated with the project")
    env: Optional[Dict[str, StrictStr]] = Field(default=None, description="Environment variables for the workspace")
    labels: Optional[Dict[str, StrictStr]] = Field(default=None, description="Labels for the workspace")
    public: Optional[StrictBool] = Field(default=None, description="Whether the workspace http preview is publicly accessible")
    var_class: Optional[StrictStr] = Field(default=None, description="The workspace class type", alias="class")
    target: Optional[StrictStr] = Field(default=None, description="The target (region) where the workspace will be created")
    cpu: Optional[StrictInt] = Field(default=None, description="CPU cores allocated to the workspace")
    gpu: Optional[StrictInt] = Field(default=None, description="GPU units allocated to the workspace")
    memory: Optional[StrictInt] = Field(default=None, description="Memory allocated to the workspace in MB")
    disk: Optional[StrictInt] = Field(default=None, description="Disk space allocated to the workspace in GB")
    auto_stop_interval: Optional[StrictInt] = Field(default=None, description="Auto-stop interval in minutes (0 means disabled)", alias="autoStopInterval")
    additional_properties: Dict[str, Any] = {}
    __properties: ClassVar[List[str]] = ["image", "user", "env", "labels", "public", "class", "target", "cpu", "gpu", "memory", "disk", "autoStopInterval"]

To Reproduce

  1. daytona server -y
  2. run python client code:
from daytona_sdk import Daytona, DaytonaConfig
config = DaytonaConfig(api_key="xxxxx", api_url="http://1.2.3.4:3986")
daytona = Daytona(config)
sandbox = daytona.create()

Expected behavior
What is the issue here, and how can I resolve it?

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

os: Linux localhost 3.10.0-1160.el7.x86_64
daytona: main branch  commit: c9476324ae5cca3a8d1e772c72297de41213c83a
daytona_api_client       0.17.0
daytona_sdk              0.14.0

Additional context

@garenchan garenchan added the bug Something isn't working label Apr 24, 2025
@Tpuljak
Copy link
Member

Tpuljak commented Apr 24, 2025

Hi @garenchan, sorry for the confusion. This repo is currently hosting code of our legacy solution for development environments.

https://app.daytona.io is not open source currently but will be very (very) soon 😃. Keep an eye out on the repo.

In the meantime, please use https://app.daytona.io only.

@Tpuljak Tpuljak closed this as completed Apr 24, 2025
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

No branches or pull requests

2 participants