aws-amplify / amplify-cli

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

TypeError: Lambda is not a constructor when setting up Lambda with Lex #8539

Closed psantora-amazon closed 3 years ago

psantora-amazon commented 3 years ago

Before opening, please confirm:

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v15.12.0

Amplify CLI Version

6.3.1

What operating system are you using?

mac

Amplify Categories

function, interactions

Amplify Commands

add

Describe the bug

psantora@147dda2f836a frontend % amplify add interactions ⚠️ Amplify command hooks are disabled in the current execution environment. ⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information. 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: testAmplify ? Would you like to start with a sample chatbot or start from scratch? Start from scratch ? Enter a name for your bot: testPoAmplify ? Choose an output voice: Male ? 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: testIntent ? Enter a sample utterance (spoken or typed phrase that invokes your intent. e.g. Book a hotel) hi tell me about yourself ? Would you like to add another utterance? Yes ? Enter a sample utterance (spoken or typed phrase that invokes your intent. e.g. Book a hotel) hi what are you ? Would you like to add another utterance? Yes ? Enter a sample utterance (spoken or typed phrase that invokes your intent. e.g. Book a hotel) hi how do you work ? 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? Amazon built-in slot type ? Choose a slot type: AMAZON.Person ? Enter a prompt for your slot (e.g. What city?) Can you please tell me your name? ? Should this slot be required? No ? Would you like to add another slot? No ? Would you like to add a confirmation prompt to your intent? No ? How would you like the intent to be fulfilled? AWS Lambda Function TypeError: Lambda is not a constructor at Object.getLambdaFunctions (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utility-functions.js:160:31) at AmplifyToolkit.executeProviderUtils [as _executeProviderUtils] (/usr/local/lib/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/execute-provider-utils.ts:7:46) at askLambda (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-interactions/provider-utils/awscloudformation/service-walkthroughs/lex-walkthrough.js:699:49) at addIntent (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-interactions/provider-utils/awscloudformation/service-walkthroughs/lex-walkthrough.js:430:20) at processTicksAndRejections (node:internal/process/task_queues:94:5) at configure (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-interactions/provider-utils/awscloudformation/service-walkthroughs/lex-walkthrough.js:299:20) at Object.executeAmplifyCommand (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-interactions/index.js:70:3) at executePluginModuleCommand (/usr/local/lib/node_modules/@aws-amplify/cli/src/execution-manager.ts:178:3) at Object.executeCommand (/usr/local/lib/node_modules/@aws-amplify/cli/src/execution-manager.ts:30:5) at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/src/index.ts:205:5) There was an error adding the interactions resource

Expected behavior

Amplify should allow me to create/assign a Lambda to Lex through the interactions command

Reproduction steps

psantora@147dda2f836a frontend % amplify add interactions ⚠️ Amplify command hooks are disabled in the current execution environment. ⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information. 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: testAmplify ? Would you like to start with a sample chatbot or start from scratch? Start from scratch ? Enter a name for your bot: testPoAmplify ? Choose an output voice: Male ? 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: testIntent ? Enter a sample utterance (spoken or typed phrase that invokes your intent. e.g. Book a hotel) hi tell me about yourself ? Would you like to add another utterance? Yes ? Enter a sample utterance (spoken or typed phrase that invokes your intent. e.g. Book a hotel) hi what are you ? Would you like to add another utterance? Yes ? Enter a sample utterance (spoken or typed phrase that invokes your intent. e.g. Book a hotel) hi how do you work ? 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? Amazon built-in slot type ? Choose a slot type: AMAZON.Person ? Enter a prompt for your slot (e.g. What city?) Can you please tell me your name? ? Should this slot be required? No ? Would you like to add another slot? No ? Would you like to add a confirmation prompt to your intent? No ? How would you like the intent to be fulfilled? AWS Lambda Function TypeError: Lambda is not a constructor at Object.getLambdaFunctions (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utility-functions.js:160:31) at AmplifyToolkit.executeProviderUtils [as _executeProviderUtils] (/usr/local/lib/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/execute-provider-utils.ts:7:46) at askLambda (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-interactions/provider-utils/awscloudformation/service-walkthroughs/lex-walkthrough.js:699:49) at addIntent (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-interactions/provider-utils/awscloudformation/service-walkthroughs/lex-walkthrough.js:430:20) at processTicksAndRejections (node:internal/process/task_queues:94:5) at configure (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-interactions/provider-utils/awscloudformation/service-walkthroughs/lex-walkthrough.js:299:20) at Object.executeAmplifyCommand (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-interactions/index.js:70:3) at executePluginModuleCommand (/usr/local/lib/node_modules/@aws-amplify/cli/src/execution-manager.ts:178:3) at Object.executeCommand (/usr/local/lib/node_modules/@aws-amplify/cli/src/execution-manager.ts:30:5) at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/src/index.ts:205:5) There was an error adding the interactions resource

GraphQL schema(s)

```graphql # Put schemas below this line ```

Log output

``` # Put your logs below this line ```

Additional information

No response

cjihrig commented 3 years ago

Thanks for reporting this. I've opened https://github.com/aws-amplify/amplify-cli/pull/8544 to fix the issue.

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.