Rasa ERROR asyncio - Task exception was never retrieved

I get this error when running rasa with botfront webchat. It works when I try with Rasa shell mode.

Versions:

rasa 2.2.0
rasa-sdk:2.2.0
Docker version 20.10.8

Command used

Action server up:  
docker run -d -v $(pwd)/actions:/app/actions --net action-link --name action-server-prod rasa-sdk:2.2.0  

Chatbot with botfront webchat  
docker run --name=pilleri --user 1003 -v $(pwd):/app -p "5013:5005" --net action-link rasa/rasa:2.2.0-full run -m models --enable-api --cors "*" --debug  

Chatbot as Rasa Shell  
docker run --name=pilleri --user 1003 -it -v $(pwd):/app -p 5013:5005 --net action-link rasa/rasa:2.2.0-full shell --debug

error

2021-09-08 14:06:20 DEBUG    rasa.core.lock_store  - Deleted lock for conversation 'ccb46afa541447fda34f1f87b7954ca2'.
2021-09-08 14:06:20 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished coro=<AsyncServer._handle_event_internal() done, defined at /opt/venv/lib/python3.7/site-packages/socketio/asyncio_server.py:475> exception=AttributeError("'NoneType' object has no attribute 'strip'") created at /opt/venv/lib/python3.7/site-packages/engineio/asyncio_server.py:322>
source_traceback: Object created at (most recent call last):
  File "/opt/venv/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/opt/venv/lib/python3.7/site-packages/rasa/__main__.py", line 116, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/opt/venv/lib/python3.7/site-packages/rasa/cli/run.py", line 90, in run
    rasa.run(**vars(args))
  File "/opt/venv/lib/python3.7/site-packages/rasa/run.py", line 57, in run
    **kwargs,
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/run.py", line 226, in serve_application
    workers=number_of_workers,
  File "/opt/venv/lib/python3.7/site-packages/sanic/app.py", line 1170, in run
    serve(**server_settings)
  File "/opt/venv/lib/python3.7/site-packages/sanic/server.py", line 856, in serve
    loop.run_forever()
  File "/opt/venv/lib/python3.7/site-packages/spf/framework.py", line 555, in _handle_request
    stream_callback)
  File "/opt/venv/lib/python3.7/site-packages/sanic/app.py", line 973, in handle_request
    response = await response
  File "/opt/venv/lib/python3.7/site-packages/engineio/asyncio_server.py", line 251, in handle_request
    packets = await socket.handle_get_request(environ)
  File "/opt/venv/lib/python3.7/site-packages/engineio/asyncio_socket.py", line 93, in handle_get_request
    return await getattr(self, '_upgrade_' + transport)(environ)
  File "/opt/venv/lib/python3.7/site-packages/engineio/asyncio_socket.py", line 136, in _upgrade_websocket
    return await ws(environ)
  File "/opt/venv/lib/python3.7/site-packages/engineio/async_drivers/sanic.py", line 122, in __call__
    await self.handler(self)
  File "/opt/venv/lib/python3.7/site-packages/engineio/asyncio_socket.py", line 228, in _websocket_handler
    await self.receive(pkt)
  File "/opt/venv/lib/python3.7/site-packages/engineio/asyncio_socket.py", line 47, in receive
    run_async=self.server.async_handlers)
  File "/opt/venv/lib/python3.7/site-packages/engineio/asyncio_server.py", line 423, in _trigger_event
    ret = await self.handlers[event](*args)
  File "/opt/venv/lib/python3.7/site-packages/socketio/asyncio_server.py", line 543, in _handle_eio_message
    await self._handle_event(sid, pkt.namespace, pkt.id, pkt.data)
  File "/opt/venv/lib/python3.7/site-packages/socketio/asyncio_server.py", line 471, in _handle_event
    data, namespace, id)
  File "/opt/venv/lib/python3.7/site-packages/socketio/asyncio_server.py", line 373, in start_background_task
    return self.eio.start_background_task(target, *args, **kwargs)
  File "/opt/venv/lib/python3.7/site-packages/engineio/asyncio_server.py", line 322, in start_background_task
    return asyncio.ensure_future(target(*args, **kwargs))
Traceback (most recent call last):
  File "/opt/venv/lib/python3.7/site-packages/socketio/asyncio_server.py", line 476, in _handle_event_internal
    r = await server._trigger_event(data[0], namespace, sid, *data[1:])
  File "/opt/venv/lib/python3.7/site-packages/socketio/asyncio_server.py", line 504, in _trigger_event
    ret = await self.handlers[namespace][event](*args)
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/channels/socketio.py", line 217, in handle_message
    await on_new_message(message)
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/channels/channel.py", line 85, in handler
    await app.agent.handle_message(*args, **kwargs)
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/agent.py", line 528, in handle_message
    return await processor.handle_message(message)
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 99, in handle_message
    await self._predict_and_execute_next_action(message.output_channel, tracker)
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 632, in _predict_and_execute_next_action
    action, tracker, output_channel, self.nlg, prediction
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 776, in _run_action
    await self.execute_side_effects(events, tracker, output_channel)
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 671, in execute_side_effects
    await self._send_bot_messages(events, tracker, output_channel)
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 687, in _send_bot_messages
    await output_channel.send_response(tracker.sender_id, e.message())
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/channels/channel.py", line 183, in send_response
    recipient_id, message.pop("text"), message.pop("buttons"), **message
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/channels/socketio.py", line 68, in send_text_with_buttons
    message_parts = text.strip().split("\n\n") or [text]
AttributeError: 'NoneType' object has no attribute 'strip'


Domain

version: "2.0"

intents:
  - aloita
  - vastaus01
  - vastaus02
  - siirry_diaan_09
  - siirry_diaan_10
  - kysymys01_vaarin
  - kysymys02_vaarin
  - kysymys03_vaarin
  - kysymys04_vaarin
  - kysymys05_vaarin
  - kysymys01_oikein
  - kysymys02_oikein
  - kysymys03_oikein
  - kysymys04_oikein
  - kysymys05_oikein

forms:
  kysymys01_form:
    vastaus01:
      - type: from_text
  kysymys02_form:
    vastaus02:
      - type: from_text
  kysymys03_form:
    vastaus03:
      - type: from_text
  kysymys04_form:
    vastaus04:
      - type: from_text
  kysymys05_form:
    vastaus05:
      - type: from_text

slots:
  vastaus01:
    type: text
    influence_conversation: false
  vastaus02:
    type: text
    influence_conversation: false
  vastaus03:
    type: text
    influence_conversation: false
  vastaus04:
    type: text
    influence_conversation: false
  vastaus05:
    type: text
    influence_conversation: false

responses:
  utter_ask_vastaus01:
  - text: "- Potilaalle on määrätty tyroksiinia 50 mikrogrammaa. Thyroxin tablettien vahvuus on 0,1 mg. Kuinka monta tablettia annat potilaalle?  \n- Montako tablettia otat purkista ja annat potilaalle?  \n- Kirjoita vastauksesi alle"

  utter_kysymys01_oikein:
  - text: Hienoa,  oikea vastaus! potilas saa oikean annoksen lääkettä.​
  utter_lopetus:
  - text: potilas saa oikean annoksen lääkettä.​
    image: "https://i.imgur.com/nGF1K8f.jpg"

  utter_kysymys01_vaarin:
  - text: "- Vastauksesi on väärin, lasketaan yhdessä uudestaan​."

  utter_ask_vastaus02:
  - text: "- Aloitetaan siitä, että muunnetaan ensin yksiköt samaan yksikköön​.  \n- Koska potilaalle on määrätty lääkeannos mikrogrammoissa, sinun täytyy muuttaa lääkepurkin vahvuutena oleva milligrammat samaan yksikköön eli mikrogrammoiksi (potilaalle oli määrätty 50 mcg)  \n- Purkissa olevan yhden tabletin vahvuus on? mikrogrammaa, kirjoita yksikönmuunnos vastauksesi alle."

  utter_kysymys02_oikein:
  - text: Hienoa, nyt on oikeat yksiköt laskua varten​.
    buttons:
    - title: " en tiedä"
      payload: "/siirry_diaan_09"
    - title: " tarkistetaan mikä olikaan potilaalle määrätty annos "
      payload: "/siirry_diaan_10"
    - title: " annetaan potilaalle 0,05 tablettia"
      payload: "/siirry_diaan_09"

  utter_dia_09:
  - text: Käydäänpä läpi miten yksikönmuunnokset tehdään. Katso Matikkapirkon video

  utter_dia_09_video:
  - text: https://www.youtube.com/watch?v=uFCDtYBG4XI

  utter_dia_09_jatka:
  - text: Ja laske sen jälkeen uudestaan
    buttons:
    - title: " siirry laskuun"
      payload: "/kysymys01_vaarin"

  utter_dia_10:
  - text: Hyvä vastaus, potilaalle oli määrätty 50 mikrogrammaa  Aletaanpa sitten laskekemaan
    buttons:
    - title: " siirry laskuun"
      payload: "/kysymys02_vaarin"

  utter_kysymys02_vaarin:
  - text: Väärä vastaus kysymykseen 02

  utter_kysymys_03:
  - text: Mikä olikaan potilaalle määrätty annos mikrogrammoina ? Tarvitset tämän tiedon pystyäksesi jatkamaan laskua​. kirjoita vastauksesi alle.

  utter_ask_vastaus_04:
  - text: Eli jos purkissa oleva tabletti on 100 mikrogrammaa ja potilaalle on määrätty 50 mikrogrammaa. Eli kuinka monta tablettia annat?​

  utter_dia_12:
  - text: Kokeillaanpa laskea verranto -laskutavalla. X = kuinka monta tablettia pitää antaa​?

  utter_ask_vastaus_05:
  - text: Lasketaan verranto  -laskutavalla​  /n- Kerrotaan ristiin 100 x X ja 50 x 1  /n- 100x = 50  /n- X = 50/100​  /n- X = 0,5 eli ___ tbl  /n- kirjoita vastauksesi alle​

  utter_kysymys05_vaarin:
  - text: Katso matikkapirkon video verranto -laskutapa​

  utter_kysymys04_vaarin:
  - text: lisää oikea teksti

  utter_dia_13:
  - text: tähän kanssa lisää


actions:
- action_tarkista_kysymys_01
- action_tarkista_kysymys_02
- action_tarkista_kysymys_04
- action_tarkista_kysymys_05

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true


Actions

from typing import Any, Text, Dict, List
from rasa_sdk.events import SlotSet
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.types import DomainDict

class kysymyksienTarkistus1(Action):
    def name(self) -> Text:
        return "action_tarkista_kysymys_01"

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


        vastaus = tracker.latest_message["text"]
        # tarkistetaan onko vastaus oikein
        if vastaus == "puolikas":
            dispatcher.utter_message(text = "vastaus oikein")
            dispatcher.utter_message(template  = "utter_kysymys01_oikein")
            dispatcher.utter_message(template =  "utter_lopetus")
            return []
        else:
            #dispatcher.utter_message(text = "vastaus väärin")
            dispatcher.utter_message(buttons = [
                {"payload": "/kysymys01_vaarin", "title": "jatka"},
            ])
            #dispatcher.utter_message(template = "utter_kysymys01_vaarin")
            #dispatcher.utter_message(intent = "/kysymys01_vaarin")
            #return ["/kysymys01_vaarin"]
            #return [UserUttered("/kysymys01_vaarin",intent={'name': 'kysymys01_vaarin', 'confidence': 1.0})]
            return []

class kysymyksienTarkistus2(Action):
    def name(self) -> Text:
        return "action_tarkista_kysymys_02"

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

        vastaus = tracker.latest_message["text"]
        # tarkistetaan onko vastaus oikein
        if vastaus == "100":
            dispatcher.utter_message(template  = "utter_kysymys02_oikein")
            return []
        else:
            #dispatcher.utter_message(template = "utter_kysymys02_vaarin")
            dispatcher.utter_message(buttons = [
                {"payload": "/kysymys02_vaarin", "title": "jatka"},])
            return []


class kysymyksienTarkistus4(Action):
    def name(self) -> Text:
        return "action_tarkista_kysymys_04"

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

        vastaus = tracker.latest_message["text"]
        # tarkistetaan onko vastaus oikein
        if vastaus == "100":
            dispatcher.utter_message(template  = "utter_kysymys01_oikein")
            return []
        else:
            dispatcher.utter_message(template = "utter_kysymys04_vaarin")
            dispatcher.utter_message(buttons = [
                {"payload": "/kysymys04_vaarin", "title": "jatka"},])
            return []

class kysymyksienTarkistus5(Action):
    def name(self) -> Text:
        return "action_tarkista_kysymys_05"

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

        vastaus = tracker.latest_message["text"]
        # tarkistetaan onko vastaus oikein
        if vastaus == "100":
            dispatcher.utter_message(template  = "utter_kysymys01_oikein")
            return []
        else:
            dispatcher.utter_message(template = "utter_kysymys05_vaarin")
            dispatcher.utter_message(buttons = [
                {"payload": "/kysymys05_vaarin", "title": "jatka"},])
            return []


Stories

version: "2.0"

stories:

- story: aloitus ja kysymys 01
  steps:
  - intent: aloita
# formi kysyy kysymyksen
  - action: kysymys01_form
  - active_loop: kysymys01_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
# formi sulkeutuu
  - action: action_tarkista_kysymys_01
  - action: action_restart

- story: kysymys 2 oikein lopetus 01
  steps:
  - action: utter_kysymys01_oikein
  - action: utter_lopetus

- story: kysymys 1 vaarin Kysy kysymys 2
  steps:
  - intent: kysymys01_vaarin
  - action: utter_kysymys01_vaarin
# formi kysyy kysymyksen
  - action: kysymys02_form
  - active_loop: kysymys02_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
# formi sulkeutuu
  - action: action_tarkista_kysymys_02
  - action: action_restart

- story: kysymys 2 oikein Valinta a ja c 01
  steps:
  - intent: kysymys02_oikein
  - action: utter_kysymys02_oikein

- story: valinta 01
  steps:
  - intent: siirry_diaan_09
  - action: utter_dia_09
  - action: utter_dia_09_video
  - action: utter_dia_09_jatka

- story: Dia 10 ja kysymys 04
  steps:
  - intent: siirry_diaan_10
  - action: utter_dia_10
  - intent: vastaus01
  - action: action_tarkista_kysymys_04

- story: Kysymys 2 vaarin Kysy 03 ja 04
  steps:
  - intent: kysymys02_vaarin
  - action: utter_kysymys02_vaarin
  - action: utter_kysymys_03
# formi kysyy kysymyksen
  - action: kysymys04_form
  - active_loop: kysymys04_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
# formi sulkeutuu
  - action: action_tarkista_kysymys_04
  - action: action_restart

#- story: Kysymys 4 oikein
#  steps:
#tämä tehdään action puolella

- story: Kysymys 4 väärin Kysy kysymys 05
  steps:
  - intent: kysymys04_vaarin
  - action: utter_dia_12
  - action: utter_dia_13
# formi kysyy kysymyksen
  - action: kysymys05_form
  - active_loop: kysymys05_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
# formi sulkeutuu
  - action: action_tarkista_kysymys_05
  - action: action_restart

#- story: Kysymys 5 oikein Palaa onnitteluun
#  steps:
# tämä tehdään action puolella


# tee tää lopuksi
- story: Kysymys 5 uudestaan
  steps:
  - action: utter_kysymys05_vaarin
  - intent: vastaus01
  - action: action_tarkista_kysymys_05

endpoints

# This file contains the different endpoints your bot can use.

# Server where the models are pulled from.
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server

#models:
#  url: http://my-server.com/models/default_core@latest
#  wait_time_between_pulls:  10   # [optional](default: 100)

# Server which runs your custom actions.
# https://rasa.com/docs/rasa/custom-actions

action_endpoint:
  url: http://action-server-prod:5055/webhook

config

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en

pipeline:
# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# # If you'd like to customize it, uncomment and adjust the pipeline.
# # See https://rasa.com/docs/rasa/tuning-your-model for more information.
   - name: WhitespaceTokenizer
   - name: RegexFeaturizer
   - name: LexicalSyntacticFeaturizer
   - name: CountVectorsFeaturizer
   - name: CountVectorsFeaturizer
     analyzer: char_wb
     min_ngram: 1
     max_ngram: 4
   - name: DIETClassifier
     epochs: 100
   - name: EntitySynonymMapper
   - name: ResponseSelector
     epochs: 100
   - name: FallbackClassifier
     threshold: 0.3
     ambiguity_threshold: 0.1

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# # No configuration for policies was provided. The following default policies were used to train your model.
# # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information.
#   - name: MemoizationPolicy
   - name: AugmentedMemoizationPolicy
   - name: TEDPolicy
     max_history: 5
     epochs: 300
   - name: RulePolicy

Here is the case when using shell, bot works and button is showed

2021-09-09 07:58:57 DEBUG    rasa.core.processor  - Predicted next action 'action_session_start' with confidence 1.00.
2021-09-09 07:58:57 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2021-09-09 07:58:57 DEBUG    rasa.core.processor  - Action 'action_session_start' ended with events '[<rasa.shared.core.events.SessionStarted object at 0x7fc6f43f9a50>, ActionExecuted(action: action_listen, policy: None, confidence: None)]'.
2021-09-09 07:58:57 DEBUG    rasa.core.processor  - Current slot values:
        vastaus01: None
        vastaus02: None
        vastaus03: None
        vastaus04: None
        vastaus05: None
        requested_slot: None
2021-09-09 07:58:57 DEBUG    rasa.core.lock_store  - Deleted lock for conversation '3e899e3b2b2442baa77d4d8b498d35f5'.
? None  (Use arrow keys)
 » 1: jatka (/kysymys01_vaarin)
   Type out your own message...