# Custom Action not working after adding external dependency

**URL:** <https://forum.rasa.com/t/custom-action-not-working-after-adding-external-dependency/33356>\
**Category:** Rasa Open Source\
**Created:** [September 3, 2020, 4:51pm UTC](https://forum.rasa.com/t/custom-action-not-working-after-adding-external-dependency/33356 "2020-09-03T16:51:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syed-Osama-Hussain](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Syed-Osama-Hussain](https://forum.rasa.com/u/Syed-Osama-Hussain)\
**Post date:** [September 3, 2020, 4:51pm UTC](https://forum.rasa.com/t/custom-action-not-working-after-adding-external-dependency/33356/1 "2020-09-03T16:51:07Z")

</div>

I’ve installed rasa x on a server using docker-compose. I added a custom action following rasa master class using docker-compose.override and it worked fine. Now I’ve updated my custom action and it uses pymongo (a python library) to connect to a mongoDB database and it doesn’t work as intended. The _price_ slot is not being set. The logs display an error **pymongo module not found**.One point to note is that it works fine locally on rasa x.

**actions.py**

```
from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.events import SlotSet
from pymongo import MongoClient

client = MongoClient(url)
db = client.floc

class ActionOrderSize(Action):

    def name(self) -> Text:
        return "action_order_size"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        items = tracker.get_slot("items")
        serving_size = tracker.get_slot("serving_size")
        price = 0
        
        for i in range(len(items)):
            item = items[i].lower().replace(" ", "")
            if serving_size[i]:
                size = serving_size[i].lower()
            else:
                size = "-"
            itemPrice = db.menu.find_one({"item":item,"size":size})
            price = price + itemPrice['price']
        return [SlotSet("price", price)]

```

**Dockerfile**

```
FROM rasa/rasa-sdk:latest

WORKDIR /app

USER root

RUN pip install pymongo

COPY ./actions /app/actions

USER 1001

```

**docker\_compose.override.yml**

```
version: '3.4'
services:
  app:
    build: .
    volumes:
      - './actions:/app/actions'
    expose:
      - '5055'
    depends_on:
      - rasa-production
```

---

<div class="post-metadata">

**Author:** ![miner](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@miner](https://forum.rasa.com/u/miner)\
**Post date:** [October 3, 2021, 6:15am UTC](https://forum.rasa.com/t/custom-action-not-working-after-adding-external-dependency/33356/2 "2021-10-03T06:15:29Z")

</div>

Is there anyone who can fix this issue? Similar here with the external dependency problem
