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

Cannot Create Workspace: 'NoneType' object has no attribute 'provider_metadata' #2

Open
mojafa opened this issue Jan 16, 2025 · 0 comments

Comments

@mojafa
Copy link

mojafa commented Jan 16, 2025

Description

I’m running into an error when attempting to create a workspace via the daytona_sdk. Specifically, the exception message is:

Failed to create workspace: 'NoneType' object has no attribute 'provider_metadata'

I’ve tried using both target="local" and target="cloud", but it fails either way. The error occurs whether I call my main script or a minimal snippet that only attempts to create then remove a workspace.

Below is the relevant code snippet and what I’ve tried so far.

Code Snippet

from daytona_sdk import Daytona, DaytonaConfig, CreateWorkspaceParams

def test_daytona():
    config = DaytonaConfig(
        api_key="MY_DAYTONA_API_KEY",                      # Confirmed correct
        server_url="https://api-f009d03f-xxxx-xxxx-xxxx-xxxxxxxxxxxx.try-eu.daytona.app",
        target="cloud"
    )

    daytona = Daytona(config=config)
    workspace = None

    try:
        params = CreateWorkspaceParams(language="python")
        workspace = daytona.create(params=params)
        print("Workspace created:", workspace)

    except Exception as e:
        print("Failed to create a workspace:", e)

    finally:
        if workspace is not None:
            daytona.remove(workspace)

test_daytona()

Current Behavior

  • Every time I run the code, I get the following error:
    Failed to create workspace: 'NoneType' object has no attribute 'provider_metadata'
    
  • The workspace object is never successfully created.

What I’ve Tried

  1. Confirmed my api_key is correct and has proper permissions.
  2. Tried target="local" vs target="cloud" to see if that changes anything.
  3. Checked environment (e.g., firewall, networking) to ensure the server URL is reachable.
  4. Searched for issues in this repo mentioning 'provider_metadata'.

Expected Behavior

  • A successful workspace creation should return a valid workspace object (with provider metadata, etc.).

Additional Context / Logs

  • Operating System: macOS m1 arm64
  • Python version: Python 3.12.7 (via Anaconda 3).
  • daytona-sdk version: (Please specify the exact version—e.g., 0.1.5).
  • Full error message or traceback:
    Traceback (most recent call last):
      File "/opt/anaconda3/lib/python3.12/site-packages/daytona_sdk/daytona.py", line 165, in create
        if not workspace.instance.projects[0].info.provider_metadata:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'provider_metadata'
    

Any guidance or fixes would be appreciated. Let me know if you need more logs or debug info to help trace the issue. Thank you!

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

No branches or pull requests

1 participant