aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 821 forks source link

Amplify interactions with Lex and Lambda is broken #8505

Closed ladawellness closed 2 years ago

ladawellness commented 2 years ago

Before opening, please confirm:

JavaScript Framework

Angular, React

Amplify APIs

Interactions

Amplify Categories

interactions

Environment information

``` # Put output below this line System: OS: Windows 10 10.0.19042 CPU: (4) x64 Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz Memory: 1.71 GB / 11.70 GB Binaries: Node: 14.16.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 7.10.0 - C:\dev\aws-learning\micro-frontends-playground\part4\mfe-parent\node_modules\.bin\npm.CMD Browsers: Chrome: 94.0.4606.81 Edge: Spartan (44.19041.1266.0), Chromium (94.0.992.50) Internet Explorer: 11.0.19041.1202 npmPackages: @angular/cdk: ^11.2.9 => 11.2.9 @angular/cdk/a11y: undefined () @angular/cdk/accordion: undefined () @angular/cdk/bidi: undefined () @angular/cdk/clipboard: undefined () @angular/cdk/coercion: undefined () @angular/cdk/collections: undefined () @angular/cdk/drag-drop: undefined () @angular/cdk/keycodes: undefined () @angular/cdk/layout: undefined () @angular/cdk/observers: undefined () @angular/cdk/overlay: undefined () @angular/cdk/platform: undefined () @angular/cdk/portal: undefined () @angular/cdk/scrolling: undefined () @angular/cdk/stepper: undefined () @angular/cdk/table: undefined () @angular/cdk/testing: undefined () @angular/cdk/testing/protractor: undefined () @angular/cdk/testing/testbed: undefined () @angular/cdk/text-field: undefined () @angular/cdk/tree: undefined () @angular/material: ^11.2.9 => 11.2.9 @angular/material/autocomplete: undefined () @angular/material/autocomplete/testing: undefined () @angular/material/badge: undefined () @angular/material/badge/testing: undefined () @angular/material/bottom-sheet: undefined () @angular/material/bottom-sheet/testing: undefined () @angular/material/button: undefined () @angular/material/button-toggle: undefined () @angular/material/button-toggle/testing: undefined () @angular/material/button/testing: undefined () @angular/material/card: undefined () @angular/material/card/testing: undefined () @angular/material/checkbox: undefined () @angular/material/checkbox/testing: undefined () @angular/material/chips: undefined () @angular/material/chips/testing: undefined () @angular/material/core: undefined () @angular/material/core/testing: undefined () @angular/material/datepicker: undefined () @angular/material/datepicker/testing: undefined () @angular/material/dialog: undefined () @angular/material/dialog/testing: undefined () @angular/material/divider: undefined () @angular/material/divider/testing: undefined () @angular/material/expansion: undefined () @angular/material/expansion/testing: undefined () @angular/material/form-field: undefined () @angular/material/form-field/testing: undefined () @angular/material/form-field/testing/control: undefined () @angular/material/grid-list: undefined () @angular/material/grid-list/testing: undefined () @angular/material/icon: undefined () @angular/material/icon/testing: undefined () @angular/material/input: undefined () @angular/material/input/testing: undefined () @angular/material/list: undefined () @angular/material/list/testing: undefined () @angular/material/menu: undefined () @angular/material/menu/testing: undefined () @angular/material/paginator: undefined () @angular/material/paginator/testing: undefined () @angular/material/progress-bar: undefined () @angular/material/progress-bar/testing: undefined () @angular/material/progress-spinner: undefined () @angular/material/progress-spinner/testing: undefined () @angular/material/radio: undefined () @angular/material/radio/testing: undefined () @angular/material/select: undefined () @angular/material/select/testing: undefined () @angular/material/sidenav: undefined () @angular/material/sidenav/testing: undefined () @angular/material/slide-toggle: undefined () @angular/material/slide-toggle/testing: undefined () @angular/material/slider: undefined () @angular/material/slider/testing: undefined () @angular/material/snack-bar: undefined () @angular/material/snack-bar/testing: undefined () @angular/material/sort: undefined () @angular/material/sort/testing: undefined () @angular/material/stepper: undefined () @angular/material/stepper/testing: undefined () @angular/material/table: undefined () @angular/material/table/testing: undefined () @angular/material/tabs: undefined () @angular/material/tabs/testing: undefined () @angular/material/toolbar: undefined () @angular/material/toolbar/testing: undefined () @angular/material/tooltip: undefined () @angular/material/tooltip/testing: undefined () @angular/material/tree: undefined () @angular/material/tree/testing: undefined () @aws-amplify/ui-react: ^1.0.6 => 1.0.6 @emotion/react: ^11.1.5 => 11.1.5 @emotion/styled: ^11.1.5 => 11.3.0 @material-ui/core: ^5.0.0-alpha.28 => 5.0.0-alpha.30 @material-ui/icons: ^5.0.0-alpha.28 => 5.0.0-alpha.28 @material-ui/styles: ^4.10.0 => 4.11.3 (5.0.0-alpha.30) @testing-library/jest-dom: ^5.11.4 => 5.11.9 @testing-library/react: ^11.1.0 => 11.2.5 @testing-library/user-event: ^12.1.10 => 12.8.3 amplify: ^0.0.11 => 0.0.11 aws-amplify: 4.3.2 => 4.3.2 chart.js: ^2.9.4 => 2.9.4 clsx: ^1.1.1 => 1.1.1 formik: ^2.1.5 => 2.2.6 history: ^5.0.0 => 5.0.0 install: ^0.13.0 => 0.13.0 lodash: ^4.17.19 => 4.17.21 moment: ^2.27.0 => 2.29.1 npm: ^7.7.4 => 7.10.0 nprogress: ^0.2.0 => 0.2.0 prop-types: ^15.7.2 => 15.7.2 react: ^17.0.1 => 17.0.1 (17.0.2) react-chartjs-2: ^2.10.0 => 2.11.1 react-dom: ^17.0.1 => 17.0.1 react-feather: ^2.0.8 => 2.0.9 react-helmet: ^6.1.0 => 6.1.0 react-perfect-scrollbar: ^1.5.8 => 1.5.8 react-router: ^6.0.0-beta.0 => 6.0.0-beta.0 react-router-dom: ^6.0.0-beta.0 => 6.0.0-beta.0 react-scripts: 4.0.3 => 4.0.3 uuid: ^8.3.0 => 8.3.2 (3.4.0, 3.3.2) web-vitals: ^1.0.1 => 1.1.1 yup: ^0.29.3 => 0.29.3 npmGlobalPackages: @angular/cli: 12.2.3 @aws-amplify/cli: 6.3.1 npm: 7.21.1 ```

Describe the bug

When running amplify add interactions command, and be asked the "how I would like the intent to be fulfilled?" question, I chose AWS Lambda Function. The result is that below stack:

? How would you like the intent to be fulfilled? AWS Lambda Function TypeError: Lambda is not a constructor at Object.getLambdaFunctions (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\src\utility-functions.js:160:31) at AmplifyToolkit.executeProviderUtils [as _executeProviderUtils] (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\execute-provider-utils.ts:7:46) at askLambda (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-category-interactions\provider-utils\awscloudformation\service-walkthroughs\lex-walkthrough.js:699:49) at addIntent (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-category-interactions\provider-utils\awscloudformation\service-walkthroughs\lex-walkthrough.js:430:20) at processTicksAndRejections (internal/process/task_queues.js:93:5) at configure (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-category-interactions\provider-utils\awscloudformation\service-walkthroughs\lex-walkthrough.js:299:20) at Object.executeAmplifyCommand (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-category-interactions\index.js:70:3) at executePluginModuleCommand (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\execution-manager.ts:178:3) at Object.executeCommand (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\execution-manager.ts:30:5) at Object.run (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\index.ts:205:5) There was an error adding the interactions resource

Expected behavior

I should be able to proceeed and get both the Lex and Lambda configuration to be deployed from Amplify CLI.

Reproduction steps

  1. amplify add interactions
  2. Fill as below:

C:\dev\aws-learning\micro-frontends-playground\part4\mfe-parent>amplify add interactions Using service: Lex, provided by: awscloudformation

Welcome to the Amazon Lex chatbot wizard You will be asked a series of questions to help determine how to best construct your chatbot.

? Provide a friendly resource name that will be used to label this category in the project: fronty ? Would you like to start with a sample chatbot or start from scratch? Start from scratch ? Enter a name for your bot: fronty ? Choose an output voice: None. This is only a text based application. ? After how long should the session timeout (in minutes)? 5 ? Please indicate if your use of this bot is subject to the Children's Online Privacy Protection Act (COPPA). Learn more: https://www.ftc.gov/tips-advice/business-center/guidance/complying-coppa-frequently-asked-questions No

First create an intent for your new chatbot. An intent represents an action that the user wants to perform.

? Give a unique name for the new intent: DeployMicroFrontend ? Enter a sample utterance (spoken or typed phrase that invokes your intent. e.g. Book a hotel) Deploy a microfrontend ? Would you like to add another utterance? No

Now, add a slot to your intent. A slot is data the user must provide to fulfill the intent.

? Enter a name for your slot (e.g. Location) Name ? Would you like to choose an Amazon built-in slot type, a slot type you've already made, or create a new slot type? Create a new slot type ? What would you like to name your slot type? MicrofrontendName ? Give a description of your slot type: Name of the Micro Frontend ? Add a possible value for your slot: payments ? Add another slot value? Yes ? Add a possible value for your slot: accounts ? Add another slot value? No ? Enter a prompt for your slot (e.g. What city?) Which micro frontend do you want to deploy? ? Should this slot be required? Yes ? Would you like to add another slot? Yes ? Enter a name for your slot (e.g. Location) Env ? Would you like to choose an Amazon built-in slot type, a slot type you've already made, or create a new slot type? Create a new slot type ? What would you like to name your slot type? Environment ? Give a description of your slot type: Environment where to deploy the microfrontend ? Add a possible value for your slot: dev ? Add another slot value? Yes ? Add a possible value for your slot: prod ? Add another slot value? No ? Enter a prompt for your slot (e.g. What city?) Which enviroment do you want to deploy to? ? Should this slot be required? Yes ? Would you like to add another slot? No ? Would you like to add a confirmation prompt to your intent? Yes ? Enter a confirmation question (e.g. Are you sure you want to order a {Drink_name}?): Are you sure? ? Enter a cancel message for when the user says no to the confirmation question (e.g. Okay. Your order will not be placed.): Ok, no offense ? How would you like the intent to be fulfilled? AWS Lambda Function TypeError: Lambda is not a constructor at Object.getLambdaFunctions (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\src\utility-functions.js:160:31) at AmplifyToolkit.executeProviderUtils [as _executeProviderUtils] (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\execute-provider-utils.ts:7:46) at askLambda (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-category-interactions\provider-utils\awscloudformation\service-walkthroughs\lex-walkthrough.js:699:49) at addIntent (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-category-interactions\provider-utils\awscloudformation\service-walkthroughs\lex-walkthrough.js:430:20) at processTicksAndRejections (internal/process/task_queues.js:93:5) at configure (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-category-interactions\provider-utils\awscloudformation\service-walkthroughs\lex-walkthrough.js:299:20) at Object.executeAmplifyCommand (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-category-interactions\index.js:70:3) at executePluginModuleCommand (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\execution-manager.ts:178:3) at Object.executeCommand (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\execution-manager.ts:30:5) at Object.run (C:\Users\ala\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\index.ts:205:5) There was an error adding the interactions resource

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line ```

aws-exports.js

const awsmobile = {
    "aws_project_region": "eu-west-1",
    "aws_cognito_identity_pool_id": "eu-west-1:<POOL_ID>",
    "aws_cognito_region": "eu-west-1",
    "aws_user_pools_id": "eu-west-1_<POOL_ID>",
    "aws_user_pools_web_client_id": "<WEB_CLIENT_ID>",
    "oauth": {},
    "aws_content_delivery_bucket": "<BUCKET_NAME>",
    "aws_content_delivery_bucket_region": "eu-west-1",
    "aws_content_delivery_url": "<CLOUDFRONT_URL>"
};

export default awsmobile;

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

chrisbonifacio commented 2 years ago

Hi @ladawellness 👋 Thanks for raising this issue. I was able to reproduce it following your reproduction steps. I will label this a bug and transfer it to the CLI repo.

Screen Shot 2021-10-20 at 12 04 03 PM
josefaidt commented 2 years ago

Hey @ladawellness to echo what @chrisbonifacio said thanks for raising this! What you've experienced is a duplicate of https://github.com/aws-amplify/amplify-cli/issues/7906 and is being actively investigated! 🙂

Closing in favor of tracking existing issue. Please subscribe to #7906 for further updates

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.