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

await table.exists() is stuck/hanging #176

Open
ishaan-jaff opened this issue Jan 15, 2024 · 3 comments
Open

await table.exists() is stuck/hanging #176

ishaan-jaff opened this issue Jan 15, 2024 · 3 comments

Comments

@ishaan-jaff
Copy link

ishaan-jaff commented Jan 15, 2024

Running this code hangs for me at await table.exists(), how can i debug this issue ? I can't see any logs

from aiohttp import ClientSession

from aiodynamo.client import Client
from aiodynamo.credentials import Credentials
from aiodynamo.expressions import F
from aiodynamo.http.aiohttp import AIOHTTP
from aiodynamo.models import Throughput, KeySchema, KeySpec, KeyType
from aiodynamo.http.httpx import HTTPX
from dotenv import load_dotenv
load_dotenv()


async def example():
    async with ClientSession() as session:
        credentials = await Credentials.auto().get_key(http=HTTPX(session))
        print(credentials)
        print(credentials.secret)
        print(credentials.id)
        print(credentials.token)
        client = Client(AIOHTTP(session), Credentials.auto(), "us-west-2")
        print(client.credentials)

        table = client.table("any-table")
        print("checking if table exists")
        does_table_exist = await table.exists()
        print("checked if exists=", does_table_exist)

        # Create table if it doesn't exist
        if not await table.exists():
            await table.create(
                Throughput(read=10, write=10),
                KeySchema(hash_key=KeySpec("key", KeyType.string)),
            )

        # Create or override an item
        await table.put_item({"key": "my-item", "value": 1})
        # Get an item
        item = await table.get_item({"key": "my-item"})
        print(item)
        # Update an item, if it exists.
        await table.update_item(
            {"key": "my-item"}, F("value").add(1), condition=F("key").exists()
        )
import asyncio

asyncio.run(example())
@ishaan-jaff
Copy link
Author

I see this in my logs:

DEBUG:aiodynamo:sending request Request(url=URL('https://dynamodb.us-west-2.amazonaws.com/'), body=b'{"TableName":"LiteLLM_VerificationToken"}')
DEBUG:aiodynamo:request failed
DEBUG:aiodynamo:sending request Request(url=URL('https://dynamodb.us-west-2.amazonaws.com/'), body=b'{"TableName":"LiteLLM_VerificationToken"}')
DEBUG:aiodynamo:request failed
DEBUG:aiodynamo:sending request Request(url=URL('https://dynamodb.us-west-2.amazonaws.com/'), body=b'{"TableName":"LiteLLM_VerificationToken"}')
DEBUG:aiodynamo:request failed
DEBUG:aiodynamo:sending request Request(url=URL('https://dynamodb.us-west-2.amazonaws.com/'), body=b'{"TableName":"LiteLLM_VerificationToken"}')
DEBUG:aiodynamo:request failed
DEBUG:aiodynamo:sending request Request(url=URL('https://dynamodb.us-west-2.amazonaws.com/'), body=b'{"TableName":"LiteLLM_VerificationToken"}')
DEBUG:aiodynamo:request failed
DEBUG:aiodynamo:sending request Request(url=URL('https://dynamodb.us-west-2.amazonaws.com/'), body=b'{"TableName":"LiteLLM_VerificationToken"}')
DEBUG:aiodynamo:request failed
DEBUG:aiodynamo:sending request Request(url=URL('https://dynamodb.us-west-2.amazonaws.com/'), body=b'{"TableName":"LiteLLM_VerificationToken"}')
DEBUG:aiodynamo:request failed

@ishaan-jaff
Copy link
Author

caused by this:

Cannot connect to host dynamodb.us-west-2.amazonaws.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

@ojii can I get help with this error? have you seen it before ?

@ojii
Copy link
Contributor

ojii commented Jan 16, 2024

huh that's a new one.

what environment is this running in (local/ec2/ecs/...)?

if this is running on AWS, have you checked your security group that there's nothing in there blocking connections?

the fact that the error is CERTIFICATE_VERIFY_FAILED indicates that this isn't an issue with aiodynamo, but your environment and/or httpx.

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

2 participants