Hi - I’m trying to deploy some AWS Lex related res...
# typescript
s
Hi - I’m trying to deploy some AWS Lex related resources but I’m struggling with the
aws.lex.V2modelsSlotType
TypeScript is happy with this:
Copy code
const timePreferenceSlotType = new aws.lex.V2modelsSlotType("TimePreferenceSlotType", {
  botId: bot.id,
  botVersion: "DRAFT",
  localeId: botLocale.localeId,
  name: "TimePreference",
  description: "Customer time and optimization preferences",
  parentSlotTypeSignature: "AMAZON.AlphaNumeric",
  valueSelectionSetting: {
    resolutionStrategy: "TOP_RESOLUTION",
    advancedRecognitionSettings: [{
      audioRecognitionStrategy: "USE_SLOT_VALUES_AS_TRANSCRIPT",
    }],
  },
  slotTypeValues: [
    {
      sampleValues: [{ value: "morning" }],
      synonyms: [
        { value: "early" },
        { value: "AM" },
        { value: "before noon" },
        { value: "first thing" },
      ],
    },
    {
      sampleValues: [{ value: "afternoon" }],
      synonyms: [
        { value: "PM" },
        { value: "after lunch" },
        { value: "midday" },
        { value: "early afternoon" },
      ],
    },
    {
      sampleValues: [{ value: "evening" }],
      synonyms: [
        { value: "late" },
        { value: "end of day" },
        { value: "after work" },
        { value: "after 5" },
      ],
    },
    {
      sampleValues: [{ value: "green" }],
      synonyms: [
        { value: "eco-friendly" },
        { value: "environmental" },
        { value: "sustainable" },
        { value: "low carbon" },
        { value: "best availability" },
      ],
    },
    {
      sampleValues: [{ value: "cheapest" }],
      synonyms: [
        { value: "lowest cost" },
        { value: "best price" },
        { value: "discount" },
        { value: "save money" },
        { value: "budget" },
      ],
    },
    {
      sampleValues: [{ value: "flexible" }],
      synonyms: [
        { value: "any time" },
        { value: "whenever" },
        { value: "no preference" },
        { value: "doesn't matter" },
      ],
    },
  ],
});
However, when deployed I get
Copy code
TimePreferenceSlotType aws:lex:V2modelsSlotType
cannot encode resource inputs to call ValidateResourceConfig: objectEncoder failed on property "slot_type_values
": Expected an Object PropertyValue, found [] ("{[{map[sampleValues:{[{map[value:{morning}]}]} synonyms:{[{map[v
alue:{early}]} {map[value:{AM}]} {map[value:{before noon}]} {map[value:{first thing}]}]}]} {map[sampleValues:{[{
map[value:{afternoon}]}]} synonyms:{[{map[value:{PM}]} {map[value:{after lunch}]} {map[value:{midday}]} {map[val
ue:{early afternoon}]}]}]} {map[sampleValues:{[{map[value:{evening}]}]} synonyms:{[{map[value:{late}]} {map[valu
e:{end of day}]} {map[value:{after work}]} {map[value:{after 5}]}]}]} {map[sampleValues:{[{map[value:{green}]}]}
 synonyms:{[{map[value:{eco-friendly}]} {map[value:{environmental}]} {map[value:{sustainable}]} {map[value:{low
carbon}]} {map[value:{best availability}]}]}]} {map[sampleValues:{[{map[value:{cheapest}]}]} synonyms:{[{map[val
ue:{lowest cost}]} {map[value:{best price}]} {map[value:{discount}]} {map[value:{save money}]} {map[value:{budge
t}]}]}]} {map[sampleValues:{[{map[value:{flexible}]}]} synonyms:{[{map[value:{any time}]} {map[value:{whenever}]
} {map[value:{no preference}]} {map[value:{doesn't matter}]}]}]}]}")
So it seems there’s a mismatch between what Pulumi defines and what AWS needs. Anyone had any joy with this or know a way around it?
m
Hi, can you share which version of the AWS provider you are using? It looks to me that in the latest v6 version 6.83.0 the slotTypeValues field does not accept an array. The documentation around this suggests that it should support an array here, so I am inclined to believe this is a bug with the pulumi AWS provider
s
Hi - yes, it’s 7.4.0
m
So I had some interesting findings. If I run your code with using version 6.83.0 of the provider, I am able to reproduce the error you shared. But if I run with version 7.4.0 the code sample above works correctly. I'm suspecting there is some version mismatch happening in your pulumi program.
s
Interesting, thank you. I'm afk right now. I'll see if I can manipulate the versions. One other factor is the use of SST V3 which has its own pulumi version bundles and I'm not sure which it is
I updated to import the aws provider directly from node_modules and the error went away, I suspect it’s a collision with the SST provided version. Thank you for taking the time to try it out and point me in the right direction 🙏
🙌 1
m
Awesome, glad you got it working!
s
Not quite so far as ‘working’ but new and different errors to resolve! Thanks again