FormAction on Server with Rasa X does not work

Hi everyone,

could you please help me. I have just uploaded my chatbot to an server. It is currently running with docker and I have the following software packages installed:

image

Everything works right except for one thing. If I want to run the FormAction the chatbot does not run it correctly:

Here is my actions.py:

from typing import Dict, Text, Any, List, Union
from rasa_sdk import Tracker, Action 
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.forms import FormAction

class SubscribeNewsletterForm(FormAction):
   
    def name(self) -> Text:
        return "abonnieren_newsletter_form"

    @staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        return ["email"] 
    
    def submit(
        self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> List[Dict]:
                       
        
        dispatcher.utter_message("Vielen Dank. Wir senden absofort hilfreiche Informationen an Ihre E-mail Adresse.")
            
        return []

how do you run your bot??? I never had don’t that but it seems that the command rasa run actions is never execute. maybe you need to put that line in you docker file?

Thank you for your reply. In my actions.py I have already tested an Action. This one runs well without any problems. I don´t think that I have to run this command in docker separately?

Does anyone have a solution for my problem?

Thanks!

Hi @Tobias, what does your training data look like? Can you share the part of stories.yml that is relevant to this form?

Hi @ricwo, here is my stories.md:

## begruessen_bestellung
* begruessen
	- utter_begruessen
	- utter_faehigkeiten

## newsletter
* newsletter_abonnieren
    - abonnieren_newsletter_form
    - form{"name":"abonnieren_newsletter_form"}
	- form{"name": null}
    - utter_anders_weiterhelfen

## verabschiedung
* verabschieden
    - utter_verabschieden

## fallback story
* out_of_scope
  - action_default_fallback


Domain.yml:

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

intents:
- begruessen
- verabschieden
- out_of_scope
- newsletter_abonnieren

entities:
- email

slots:
  email:
    type: unfeaturized
  requested_slot:
    type: unfeaturized
    auto_fill: false

responses:
  utter_begruessen:
  - text: Hi!
  utter_faehigkeiten:
  - buttons:
    - payload: Newsletter abonnieren
      title: Newsletter abonnieren
    text: Ich bin Chati, ein digitaler Assistent! Gerne kann ich Ihnen bei folgenden
      Themen weiterhelfen.
  utter_ask_email:
  - text: Geben Sie Ihre E-mail Adresse an, um weitere Informationen zu erhalten!
  utter_anders_weiterhelfen:
  - text: Kann ich Ihnen noch anderweitig helfen?
  utter_default:
  - buttons:
    - payload: Newsletter abonnieren
      title: Newsletter abonnieren
    text: Leider hab ich nicht immer eine passende Antwort. Gerne kann ich Ihnen bei
      folgenden Themen weiterhelfen
  utter_verabschieden:
  - text: Vielen Dank für Ihr Vertrauen. Bis dann!

actions:
- utter_begruessen
- utter_faehigkeiten
- utter_anders_weiterhelfen
- utter_default
- utter_verabschieden
- utter_ask_email

forms:
- abonnieren_newsletter_form

config.yml:

language: de
pipeline:
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: "char_wb"
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 50
  - name: EntitySynonymMapper

policies:
  - name: MemoizationPolicy
    max_history: 5
  - name: TEDPolicy
    max_history: 5
    epochs: 100
  - name: MappingPolicy
  - name: FormPolicy
  - name: FallbackPolicy
    nlu_threshold: 0.4
    core_threshold: 0.5
    fallback_action_name: "action_default_fallback"

Would you mind sharing the output logs of rasa-sdk and rasa-production? Also, is the message you sent (“Newsletter abonnieren”) the first one in the conversation?

How can I share the output logs of rasa-sdk and rasa-production? What is the command for that?`

No, I started the conversation with “Hi” as user.

@ricwo @akelad @stephens @mloubser @erohmensing
There seems to be an issue with a new event (active_loop) that rasa forms don’t recognize. I am having the same issue, it used to work but it doesn’t now. I am using rasa version 1.10.10 and rasa x version 0.32.2:

rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.nlu.selectors.response_selector  - Adding following selector key to message property: default
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.processor  - Received user message 'need a house' with intent '{'name': 'inform', 'confidence': 0.9481670260429382}' and entities '[]'
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 7 events.
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.policies.memoization  - Current tracker state [{'intent_inform': 1.0, 'prev_action_listen': 1.0}]
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.policies.memoization  - There is a memorised next action 'my_form'
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.policies.form_policy  - There is no active form
rasa-production_1  | 2020-10-04 01:05:37 INFO     root  - return all zero probabilities, nothing to do 
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_0_MemoizationPolicy
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.processor  - Predicted next action 'my_form' with confidence 1.00.
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.actions.action  - Calling action endpoint to run action 'my_form'.
rasa-production_1  | 2020-10-04 01:05:37 ERROR    rasa.core.processor  - Encountered an exception while running action 'my_form'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.processor  - Unknown event name 'active_loop'.
rasa-production_1  | Traceback (most recent call last):
rasa-production_1  |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 650, in _run_action
rasa-production_1  |     events = await action.run(output_channel, nlg, tracker, self.domain)
rasa-production_1  |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/actions/action.py", line 562, in run
rasa-production_1  |     evts = events.deserialise_events(events_json)
rasa-production_1  |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/events/__init__.py", line 39, in deserialise_events
rasa-production_1  |     event = Event.from_parameters(e)
rasa-production_1  |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/events/__init__.py", line 142, in from_parameters
rasa-production_1  |     event_class: Optional[Type[Event]] = Event.resolve_by_type(event_name, default)
rasa-production_1  |   File "/opt/venv/lib/python3.7/site-packages/rasa/core/events/__init__.py", line 195, in resolve_by_type
rasa-production_1  |     raise ValueError(f"Unknown event name '{type_name}'.")
rasa-production_1  | ValueError: Unknown event name 'active_loop'.
rasa-production_1  | 2020-10-04 01:05:37 DEBUG    rasa.core.processor  - Action 'find_property_form' ended with events '[]'.

Hi @ricwo,

do you have any recommandations so far?

@Tobias it would still be great to see your logs for rasa-production and rasa-sdk. To get those, please run sudo docker ps -a and then run sudo docker logs <X>, substituting the names of the two containers for <X>

@basil-chatha The active_loop event was introduced in Rasa 2.0. Please check out the docs on Forms

Here are the logs for production:

Here for rasa-sdk:

I had the same issue where form action wasn’t found I followed (Ep #9 - Rasa Masterclass) Improving the assistant: Setting up the Rasa X | Rasa 1.8.0 - YouTube.

Didn’t follow any other steps of creating action server separately


Finally - all started working

Get Action server Image container Id by running

Run : sudo docker ps

The container Id 603339fd04e0 is mapped to Image: rasa/rasa-sdk:latest
COMMAND : "./entrypoint.sh Ports : 5055/tcp

Run: docker container restart 603339fd04e0

This is the action server, I restarted then Rasa X was able to find the actions registered, and is responding.