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

HubSpot search API — RuntimeError: cannot join current thread #249

Open
NickNaskida opened this issue Dec 1, 2023 · 0 comments
Open

Comments

@NickNaskida
Copy link

Hello, I am using this package in my FastAPI application:

async def handle_email_payload(email, db_session):
    public_object_search_request = PublicObjectSearchRequest(
        filter_groups=[
            {
                "filters": [
                    {
                        "value": email,
                        "propertyName": "email",
                        "operator": "EQ"
                    }
                ]
            }
        ],
        properties=["phone", "instagram_handle"],
        limit=10
    )

    try:
        thread = hubspot_client.crm.contacts.search_api.do_search(
            public_object_search_request=public_object_search_request,
            async_req=True,
        )
        result = thread.get()
        fetched_contact = result.to_dict().get("results")[0]
    except ApiException as e:
        logger.error(f"Failed to fetch contact with email: {email}. Error: {e}")
        return
    except Exception as e:
        logger.error(f"Failed to fetch contact with email: {email}. Fetched contact: {result.to_dict()}. Error: {e}")
        return

    contact_id = fetched_contact.get("id")

This code raises this error every time:

Exception ignored in: <function ApiClient.del at 0x15a61fc40>
Traceback (most recent call last):
File "/Users/nick/Desktop/Code/Work/Educate/backend/venv/lib/python3.11/site-packages/hubspot/crm/contacts/api_client.py", line 85, in del
self._pool.join()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/pool.py", line 669, in join
p.join()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1109, in join
raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread

Any suggestions on how to resolve this issue?

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