- 最新
- 投票最多
- 评论最多
Did you build the Lex v2 bot? If so, you need to use the Lex v2 API endpoint. The documentation you referred to is a bit old and uses the v1 endpoint. I recommend trying out the v2 API endpoint and see if you still have the same issue.
Thank you Taka_M. Yup, that was my issue.
Also, for anyone else reading this I struggled a little to find the new endpoint URL, depending your region you will find it https://docs.aws.amazon.com/general/latest/gr/lex.html.
However, I have hit an issue where in v2 the SessionID is required. Is there a way to generate a SessionID in Postman?
Thanks Taka, am hitting the below issue now. from my post call, https://runtime-v2-lex.us-east-1.amazonaws.com/bots/botID/botAliases/botAliasID/botLocales/en_GB/sessions/test
{ "message": "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details." }
I managed to get this working.
The error i was getting around the signature was due to my access key. You need to use user who has 'AmazonLexReadOnly' & 'AmazonLexRunBotsOnly' permissions.
hello @dowen93to98 I had a similar issues, but I got this error:
{ "message": "Credential should be scoped to correct service: 'lex'. " }
How did you give access? I'm kinda new in AWS i read a lot and I can't figure out what's going on, i did the following:
- Create a CLI aws account (test user)
- I added the permissions: AmazonLexReadOnly and AmazonLexRunBotsOnly I even added another that I read in another website ( I Created a new policy) with this json:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "lex:GetSession", "lex:RecognizeText", "lex:PutSession", "lex:DeleteSession", "lex:StartConversation", "lex:RecognizeUtterance" ], "Resource": "*" } ] }
- I created an access api key/secret key
- Added to postman as AWS identification and hitting this url
https://runtime-v2-lex.us-east-1.amazonaws.com/bots/KVI5WI1AAA/botAliases/UZA1JMDAAA/botLocales/en_US/sessions/random/text
(the last letters I replaced with AAA just to hide the complete url and check if is the name or the ID)
I got the botId from lex website, the alias I think is the correct (same from lex but I'm not sure if is the name or this ID), the (access key 1 is the one I'm using, and says Access key last usedNever
I can't figure out what's wrong, I tried to read a lot of tutorials but I have no luck, could you please help me out and telling me how I can setup the user? Thanks
相关内容
- AWS 官方已更新 2 年前
You will need to supply the sessionId on your own. You can use an id like test just for testing purpose. For your application, you can generate a random ID using a uuid package, etc.
https://docs.aws.amazon.com/lexv2/latest/APIReference/API_runtime_PutSession.html#API_runtime_PutSession_RequestParameters