ZunX
ZunX

Reputation: 11

amazon Lex bot v2 creation via aws cdk issue Couldn't import a locale. Locale ‘en_US’ in the zip file doesn't contain a fallback intent

I’m trying to create a Lex Bot V2 using AWS CDK with the following code:

const bot = new lex.CfnBot(this, "MyLexBot", {
  name: "MyBot",
  dataPrivacy: { ChildDirected: false },
  idleSessionTtlInSeconds: 300,
  roleArn: lexRole.roleArn,
  botLocales: [
    {
      localeId: "en_US",
      nluConfidenceThreshold: 0,
      intents: [
        {
          name: "OrderIntent",
          sampleUtterances: [
            { utterance: "hello" },
            { utterance: "I want to order" },
            { utterance: "Can I place an order?" },
          ],
          fulfillmentCodeHook: { enabled: false },
        },
        {
          name: "CustomFallbackIntent",
          description: "Default fallback intent",
          parentIntentSignature: "AMAZON.FallbackIntent",
          fulfillmentCodeHook: { enabled: false },
        },
      ],
    },
  ],

however i keep getting this error: Couldn't import a locale. Locale ‘en_US’ in the zip file doesn't contain a fallback intent. Provide a fallback intent for the locale, then try your request again.

I even tried to first create the botLocales without the intents as stated in the screenshot. enter image description here If anyone has any tips or advice, I would really appreciate it

Upvotes: 1

Views: 129

Answers (1)

ZunX
ZunX

Reputation: 11

The issue was with the fallback intent's name—it has to be set as name: "FallbackIntent" for it to work properly. This isn't super obvious in the documentation, so it's easy to miss

Upvotes: 0

Related Questions