# elastic connectors has error : cannot import name 'coroutine' from 'asyncio'

**URL:** <https://discuss.elastic.co/t/elastic-connectors-has-error-cannot-import-name-coroutine-from-asyncio/353019>\
**Category:** Elastic Search\
**Tags:** docker, elastic-app-search\
**Created:** [February 11, 2024, 2:48pm UTC](https://discuss.elastic.co/t/elastic-connectors-has-error-cannot-import-name-coroutine-from-asyncio/353019 "2024-02-11T14:48:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![trunglh88](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/trunglh88/32/131638_2.png) [@trunglh88](https://discuss.elastic.co/u/trunglh88)\
**Post date:** [February 11, 2024, 2:48pm UTC](https://discuss.elastic.co/t/elastic-connectors-has-error-cannot-import-name-coroutine-from-asyncio/353019/1 "2024-02-11T14:48:26Z")

</div>

i using elastic connectors to mongodb with docker, when i run then elastic connectors show error like this

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/9/a910078434d28470142baf7205acad47de4d143b.png)

this is config.yml

```auto
connectors:
-
  connector_id: "id_here"
  service_type: "mongodb"
  api_key: "key_in_here"
  
elasticsearch:
  ca_certs: "/config/certs/ca/ca.crt"  
  host: "https://es01:9200"
  api_key: "key_in_here"
 
sources:
  mongodb: connectors.sources.mongo:MongoDataSource

```

is this problem when connectors is try connect to mongodb ?

---

<div class="post-metadata">

**Author:** ![nfeekery](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nfeekery/32/117349_2.png) [@nfeekery](https://discuss.elastic.co/u/nfeekery)\
**Post date:** [February 12, 2024, 2:40pm UTC](https://discuss.elastic.co/t/elastic-connectors-has-error-cannot-import-name-coroutine-from-asyncio/353019/2 "2024-02-12T14:40:29Z")

</div>

Hi @trunglh88, thanks for your post!

Your issue doesn't seem to be a connection to mongodb problem. For some reason the library we use for mongodb (AsyncIOMotorClient) doesn't seem to be working when the connector begins running.

I took a look and I was able to replicate it myself by trying to run the 8.12.1.0 docker with mongodb as the source choice. It appears to be a bug! I'm sorry you've encountered that.

It appears to have been introduced in 8.12, so if you run an 8.11 stack it shouldn't occur.  
Alternatively, you can try and manually build the docker image with a 3.10 version of python. The breaking changes were implemented [here](https://github.com/elastic/connectors/pull/1911) so if you rebuild the docker image with the old dockerfile, this shouldn't occur anymore. [Here are the steps for manually building and running a dockerfile.](https://github.com/elastic/connectors/blob/8.12/docs/DOCKER.md#run-connector-service-in-docker)

We'll discuss on the team how to fix this going forward and I'll update you once there's a functioning 8.12+ mongodb docker image available.

---

<div class="post-metadata">

**Author:** ![nfeekery](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nfeekery/32/117349_2.png) [@nfeekery](https://discuss.elastic.co/u/nfeekery)\
**Post date:** [February 12, 2024, 2:55pm UTC](https://discuss.elastic.co/t/elastic-connectors-has-error-cannot-import-name-coroutine-from-asyncio/353019/3 "2024-02-12T14:55:07Z")

</div>

I saw your [github issue](https://github.com/elastic/connectors/issues/2144) on the connectors repo so I've left a response there as well.

---

<div class="post-metadata">

**Author:** ![trunglh88](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/trunglh88/32/131638_2.png) [@trunglh88](https://discuss.elastic.co/u/trunglh88)\
**Post date:** [February 12, 2024, 3:25pm UTC](https://discuss.elastic.co/t/elastic-connectors-has-error-cannot-import-name-coroutine-from-asyncio/353019/4 "2024-02-12T15:25:24Z")

</div>

i will try with 8.11 stack.  
thanks you.

---

<div class="post-metadata">

**Author:** ![nfeekery](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nfeekery/32/117349_2.png) [@nfeekery](https://discuss.elastic.co/u/nfeekery)\
**Post date:** [February 13, 2024, 9:33am UTC](https://discuss.elastic.co/t/elastic-connectors-has-error-cannot-import-name-coroutine-from-asyncio/353019/5 "2024-02-13T09:33:28Z")

</div>

@trunglh88 you're welcome, thanks for flagging the issue for us!

The 8.12.1.1 docker image was built last night and includes the fix for this. I tried running it locally and this specific issue is resolved. So if you'd like to use 8.12 again, there is also that option.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 12, 2024, 9:33am UTC](https://discuss.elastic.co/t/elastic-connectors-has-error-cannot-import-name-coroutine-from-asyncio/353019/6 "2024-03-12T09:33:35Z")

</div>

Closed on March 12, 2024, 9:33am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
