Custom Sentiment Component - ERROR asyncio - Task exception was never retrieved

Hello everyone,

I am working on a chatbot and I am trying to use a custom sentiment component that we have on Docker. You can find the code for the sentiment component, my config.yml, and the error below. I would really appreciate any help here. I can’t understand where the process sticks. For the moment I am using another pretrained model (TextBlob) and it works fine.

from rasa.nlu.components import Component
from rasa.nlu import utils
from rasa.nlu.model import Metadata

import requests

import os

class SentimentAnalyzer(Component):
    """A pre-trained sentiment component"""

    name = "sentiment"
    provides = ["entities"]
    requires = []
    defaults = {}
    language_list = ["en", "el"]

    def __init__(self, component_config=None):
        super(SentimentAnalyzer, self).__init__(component_config)

    def train(self, training_data, cfg, **kwargs):
        """Not needed, because the the model is pretrained"""
        pass

    def convert_to_rasa(self, value, confidence):
        """Convert model output into the Rasa NLU compatible output format."""

        entity = {
            "value": value,
            "confidence": confidence,
            "entity": "sentiment",
            "extractor": "sentiment_extractor",
        }

        return entity

    def process(self, message, **kwargs):
        """Retrieve the text message, pass it to the classifier
            and append the prediction results to the message class."""

        str = message.data["text"]
        data = {"text": str}
        response = requests.post(
            "url_to_docker", json=data
        )   
        # resp = eval(response.text).get("result") 

        # if resp[0] < 0:
        #     sentiment = "neg"
        # elif resp[0] > 0:
        #     sentiment = "pos"
        # else:
        #     sentiment = "neu"

        resp = response.json()  # This returns {"class":"positive","score":75.0}

        sentiment = resp.get("class")
        score = resp.get("score")

        entity = self.convert_to_rasa(sentiment, score)

        message.set("entities", [entity], add_to_output=True)

    def persist(self, file_name, dir_name):
        """Pass because a pre-trained model is already persisted"""

        pass
language: en

pipeline:
  - name: sentiment.SentimentAnalyzer
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: char_wb
    min_ngram: 1
    max_ngram: 4
  - name: "DucklingEntityExtractor"
    url: "http://localhost:8000"
    dimensions: ["time"]
  - name: DIETClassifier
    epochs: 100
    constrain_similarities: true
  - name: EntitySynonymMapper
  - name: FallbackClassifier
    threshold: 0.25

policies:  
 - name: "MemoizationPolicy"
    max_history: 8
  - name: "TEDPolicy"
    max_history: 8
    epochs: 200
    constrain_similarities: true
  - name: "UnexpecTEDIntentPolicy"
    max_history: 6
    epochs: 100
  - name: "RulePolicy"

UPDATE 1

I am pasting also a part of the rasa shell --debug

2022-05-16 08:38:25 DEBUG    urllib3.connectionpool  - Starting new HTTP connection (1): "url_to_docker"
2022-05-16 08:38:26 DEBUG    urllib3.connectionpool  - "url_to_docker" "POST /sentiment HTTP/1.1" 200 32
2022-05-16 08:38:26 DEBUG    urllib3.connectionpool  - Starting new HTTP connection (1): localhost:8000
2022-05-16 08:38:26 DEBUG    urllib3.connectionpool  - http://localhost:8000 "POST /parse HTTP/1.1" 200 None
2022-05-16 08:38:27 DEBUG    rasa.core.processor  - Received user message 'hello' with intent '{'id': 832845881858887748, 'name': 'greet', 'confidence': 0.9997940063476562}' and entities '[{'value': 'neutral', 'confidence': 87.0, 'entity': 'sentiment', 'extractor': 'sentiment_extractor'}]'

Not sure how to interpret these lines. I think there is an issue in lines:

2022-05-16 08:38:26 DEBUG    urllib3.connectionpool  - Starting new HTTP connection (1): localhost:8000
2022-05-16 08:38:26 DEBUG    urllib3.connectionpool  - http://localhost:8000 "POST /parse HTTP/1.1" 200 None

UPDATE 2

Rasa Version      :         2.8.3
Minimum Compatible Version: 2.8.0
Rasa SDK Version  :         2.8.1
Rasa X Version    :         None
Python Version    :         3.8.9
Operating System  :         Windows-10-10.0.22000-SP0

Solved. If anyone has the same issue, I had to add the docker URL in the config file under the custom component.

language: en

pipeline:
  - name: sentiment.SentimentAnalyzer
    URL: url_to_docker