I'm following the guide for starting with Interactions. When I call the send
method on Interactions, I get the following error:
(node:27796) UnhandledPromiseRejectionWarning: MissingRequiredParameter: Missing required key 'userId' in params
It looks like Interactions is expecting a userId param, which in @aws-amplify/interactions/lib/Providers/AWSLexProvider.js
, is supposed to be pulled from credentials.identityId
. However, when I log credentials
, it is type SharedIniFileCredentials
, which does not have an identityId
property according to the documentation.
From reading the docs, identityId
would have to be a Cognito user. AWSLexProvider.js
makes no attempt at calling CognitoIdentityCredentials
to get Cognito credentials.
Hence, I am not sure where identityId
is supposed to come from.
My code is the example from the Amplify website:
import Amplify, { Interactions } from 'aws-amplify';
import aws_exports from './aws-exports';
Amplify.configure(aws_exports);
async function test() {
let userInput = "I want to reserve a hotel for tonight";
// Provide a bot name and user input
const response = await Interactions.send("BookTrip", userInput);
// Log chatbot response
console.log (response['message']);
}
test();
So what am I missing here?