jovotech / jovo-cli

🛠 Command Line Interface for the Jovo Framework: Makes voice experience deployment a breeze, including features like local development and staging.
https://www.jovo.tech/marketplace/jovo-cli
Apache License 2.0
57 stars 31 forks source link

Jovo build type error -> Cannot read property 'replace' of undefined #57

Closed wahidshafique closed 5 years ago

wahidshafique commented 5 years ago

I'm submitting a...

Expected Behavior

I expected the json file to be built for the respective platforms. I ran this command after I reversed an existing json I had made for a dialogflow project. Note that it also stripped out the responses that I had in the original. I am not sure if that is expected behavior or is related to the issue at hand,

Current Behavior

It spits this out

C:\Users\Wahid\Documents\Projects\voice\dt_quoter_jovo> jovo build

   √ Updating /platforms/alexaSkill
     √ Updating Alexa project files
       √ skill.json
     √ Updating Alexa Interaction Model based on Jovo Language Model in /models
       √ en-CA
   > Updating /platforms/googleAction/dialogflow
     √ Updating Dialogflow Agent
       √ agent.json
       √ package.json
     > Updating Dialogflow Language Model based on Jovo Language Model in /models
       × en-CA
         -> Cannot read property 'replace' of undefined
{ TypeError: Cannot read property 'replace' of undefined
    at DialogFlowAgent.transform (C:\Users\Wahid\AppData\Roaming\npm\node_modules\jovo-cli\helper\dialogFlowAgent.js:422:64)
    at Promise (C:\Users\Wahid\AppData\Roaming\npm\node_modules\jovo-cli\helper\dialogflowUtil.js:220:21)
    at new Promise (<anonymous>)
    at Object.buildLanguageModelDialogFlow (C:\Users\Wahid\AppData\Roaming\npm\node_modules\jovo-cli\helper\dialogflowUtil.js:215:16)
    at Task.task (C:\Users\Wahid\AppData\Roaming\npm\node_modules\jovo-cli\commands\tasks.js:332:42)
    at Promise.resolve.then.then.skipped (C:\Users\Wahid\AppData\Roaming\npm\node_modules\jovo-cli\node_modules\listr\lib\task.js:168:30)
    at <anonymous>
  context:
   { locales: [ 'en-CA' ],
     type: [ 'alexaSkill', 'googleAction' ],
     projectId: 'dt-quoter',
     endpoint: 'jovo-webhook',
     target: 'all',
     src: 'C:\\Users\\Wahid\\Documents\\Projects\\voice\\dt_quoter_jovo\\',
     stage: '',
     askProfile: 'default' } }

log (en-ca file)

{
    "invocation": "dt quoter",
    "intents": [
        {
            "name": "10_get_dt_employee",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_dt_employee"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_apply_promo",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "yes-no",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "11_get_promo_no",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_apply_promo"]
            },
            "inputs": [
                {
                    "name": "yes-no",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "11_get_promo_yes",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_apply_promo"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_what_is_promo",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "yes-no",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "12_get_promo_characters",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_what_is_promo"]
            }
        },
        {
            "name": "1_begin_report",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_begin_yes_no"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_province",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            }
        },
        {
            "name": "1_end_report",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_begin_yes_no"],
                "priority": 1000000
            },
            "inputs": [
                {
                    "name": "yes-no",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "1_would_like_to_recieve_email",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_wants_email"],
                "events": [
                    {
                        "name": "awaiting_wants_email"
                    }
                ],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_province",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "yes-no",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "2_get_province",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_province"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_coverage",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "province",
                    "type": "province"
                }
            ]
        },
        {
            "name": "2_is_from_quebec",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_province"],
                "priority": 1000000
            },
            "inputs": [
                {
                    "name": "excluded_province",
                    "type": "excluded_province"
                }
            ]
        },
        {
            "name": "3_get_coverage",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_coverage"],
                "webhookUsed": true,
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_age",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "coverage",
                    "type": {
                        "dialogflow": "@sys.unit-currency",
                        "alexa": "AMAZON.number"
                    }
                }
            ]
        },
        {
            "name": "3_get_coverage_incorrect",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_coverage_incorrect"],
                "priority": 750000,
                "events": [
                    {
                        "name": "awaiting_coverage_incorrect"
                    }
                ],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_coverage",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            }
        },
        {
            "name": "4_get_dob",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_age"],
                "webhookUsed": true,
                "events": [
                    {
                        "name": "awaiting_age"
                    }
                ],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_sex",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "dob",
                    "type": {
                        "dialogflow": "@sys.date",
                        "alexa": "AMAZON.DATE"
                    }
                }
            ]
        },
        {
            "name": "4_get_dob_no_year",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_age_incorrect"],
                "events": [
                    {
                        "name": "awaiting_age_incorrect"
                    }
                ],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_age",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            }
        },
        {
            "name": "4_get_dob_underage",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_age_underage"],
                "priority": 1000000,
                "events": [
                    {
                        "name": "awaiting_age_underage"
                    }
                ],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_age",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            }
        },
        {
            "name": "5_get_sex",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_sex"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_tobacco",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "sex",
                    "type": "sex"
                }
            ]
        },
        {
            "name": "6_get_tobacco",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_tobacco"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_ecig",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "yes-no",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "7_get_ecig",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_ecig"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_home_or_auto",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "ecig",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "8_get_home_auto",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_home_or_auto"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_dt_wealth",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "yes-no",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "9_get_dt_wealth",
            "phrases": [],
            "dialogflow": {
                "contexts": ["awaiting_dt_wealth"],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_dt_employee",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ]
            },
            "inputs": [
                {
                    "name": "yes-no",
                    "type": "yes-no"
                }
            ]
        },
        {
            "name": "Quit",
            "phrases": [],
            "dialogflow": {
                "priority": 1000000
            }
        }
    ],
    "inputTypes": [
        {
            "name": "excluded_province",
            "values": [
                {
                    "value": "quebec",
                    "synonyms": ["quebec"]
                }
            ]
        },
        {
            "name": "province",
            "values": [
                [
                    {
                        "value": "Yukon",
                        "synonyms": ["Yukon"]
                    },
                    {
                        "value": "Saskatchewan",
                        "synonyms": ["Saskatchewan"]
                    },
                    {
                        "value": "Prince Edward Island",
                        "synonyms": ["Prince Edward Island"]
                    },
                    {
                        "value": "Ontario",
                        "synonyms": ["Ontario"]
                    },
                    {
                        "value": "Nunavut",
                        "synonyms": ["Nunavut"]
                    },
                    {
                        "value": "Northwest Territories",
                        "synonyms": ["Northwest Territories"]
                    },
                    {
                        "value": "Nova Scotia",
                        "synonyms": ["Nova Scotia"]
                    },
                    {
                        "value": "Newfoundland and Labrador",
                        "synonyms": ["Newfoundland and Labrador"]
                    },
                    {
                        "value": "New Brunswick",
                        "synonyms": ["New Brunswick"]
                    },
                    {
                        "value": "Manitoba",
                        "synonyms": ["Manitoba"]
                    },
                    {
                        "value": "British Columbia",
                        "synonyms": ["British Columbia"]
                    },
                    {
                        "value": "Alberta",
                        "synonyms": ["Alberta"]
                    }
                ]
            ]
        },
        {
            "name": "sex",
            "values": [
                {
                    "value": "male",
                    "synonyms": ["male", "man", "guy", "dude", "bro", "boy"]
                },
                {
                    "value": "female",
                    "synonyms": ["female", "girl", "woman", "gal", "lady"]
                }
            ]
        },
        {
            "name": "yes-no",
            "values": [
                {
                    "value": "yes",
                    "synonyms": ["yes"]
                },
                {
                    "value": "no",
                    "synonyms": ["no"]
                }
            ]
        }
    ],

    "dialogflow": {
        "intents": [
            {
                "fallbackIntent": true,
                "name": "Default Fallback Intent"
            },
            {
                "events": [
                    {
                        "name": "WELCOME"
                    }
                ],
                "responses": [
                    {
                        "affectedContexts": [
                            {
                                "name": "awaiting_begin_yes_no",
                                "parameters": {},
                                "lifespan": 1
                            }
                        ]
                    }
                ],
                "name": "Default Welcome Intent"
            }
        ]
    },

    "alexa": {
        "interactionModel": {
            "languageModel": {
                "intents": [
                    {
                        "name": "AMAZON.CancelIntent",
                        "samples": []
                    },
                    {
                        "name": "AMAZON.HelpIntent",
                        "samples": []
                    },
                    {
                        "name": "AMAZON.StopIntent",
                        "samples": []
                    }
                ]
            }
        }
    }
}

Your Environment

janober commented 5 years ago

Very sorry for the late response! Our effort to get v2 of the framework out sadly resulted in a backlog of open issues. I had now a look at your problem and it seems like the data you provided for "province" is invalid. Under "values" there should be an array of objects but you have an array of an array of objects. When you simply remove the second enclosing [ ... ] it will work fine. Did you generate the file manually? If not and our CLI did generate that data it would be great to get additional information how exactly that we are able to fix that bug. Thanks a lot!

wahidshafique commented 5 years ago

I appreciate the reply! A bit of laziness on my part as it was actually fixed by exactly that, simply removing the nesting. It was a while ago but I believe that I generated it manually. I will try to run some scenarios and see if I can try to find other build issues. But closing this now, thanks Jan!

janober commented 5 years ago

Great to hear! Thanks for informing us about how the file got generated. So we know now at least that it is not a bug in the CLI. Sorry again for the late reply. Have a great day.