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

Using stages in CLI v2 breaks `jovo build` #75

Closed rmtuckerphx closed 5 years ago

rmtuckerphx commented 5 years ago

I'm submitting a...

Expected Behavior

Executing jovo build when using stages and defaultStage should build for the default stage.

Current Behavior

  1. Create new project using jovo new hello-jovo2
  2. jovo build

image

  1. Update project.js to include stages:
module.exports = {
    alexaSkill: {
       nlu: 'alexa',
    },
    googleAction: {
       nlu: 'dialogflow',
    },
    defaultStage: 'local',
    stages: {
      local: {
        endpoint: `${JOVO_WEBHOOK_URL}`
      },
      dev: {
        endpoint: ""
      },
      prod: {
        endpoint: ""
      }
    }
};
  1. Execute jovo build again:

image

  1. Execute jovo build --stage local:

image

Error log

The error is: The "C:\dev\voice\shazaml\hello-jovo2\project.js" file is missing or invalid!

Your Environment

janober commented 5 years ago

Just checked and could reproduce the error. After looking into the cause I found that the issue is in the changes you made to the project.js file. You are using backticks instead of single/double quotes. So your code says it should look for a variable which is called "JOVO_WEBHOOK_URL" and take its value but that variable does not exist. Because of that it then errors as it can not execute the file.

So if you chang the line:

endpoint: `${JOVO_WEBHOOK_URL}`

to:

endpoint: '${JOVO_WEBHOOK_URL}'

it should work fine.

Hope that helps!

janober commented 5 years ago

To avoid such problems in the future (as I guess that will happen quite a lot) did I just commit some code which adds "JOVO_WEBHOOK_URL" temporary as a global variable when reading the project.js. So with the next version of the CLI it will also work with backticks.

jankoenig commented 5 years ago

Thanks @janober! And sorry @rmtuckerphx, that one was on me, just noticed (and updated!) that in some tutorials we used backticks for the Jovo Webhook URL. Should be changed everywhere

jankoenig commented 5 years ago

Closing this now