amazon-connect / amazon-connect-message-streaming-examples

This repository contains an example project on how to get started with Amazon Connect Chat Message Streaming APIs to enable SMS and Facebook messenger channels for customer service.
MIT No Attribution
23 stars 39 forks source link

Errors in outbound lambda function #11

Open ahmedyounis opened 2 years ago

ahmedyounis commented 2 years ago

These 2 errors are repeating multiple times within the Outbound Lambda function. SMS messages from mobile to cpp is showing up on the cpp window. However, messages from the cpp window do not show up on the mobile phone.

{ "errorType": "NotFoundException", "errorMessage": "Resource not found", "code": "NotFoundException", "message": "Resource not found", "time": "2021-12-07T14:56:01.705Z", "requestId": "a3a8aa46-1539-4ec1-9c6b-41c8eb989314", "statusCode": 404, "retryable": false, "retryDelay": 15.976111499447732, "stack": [ "NotFoundException: Resource not found", " at Object.extractError (/var/task/node_modules/aws-sdk/lib/protocol/json.js:52:27)", " at Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/rest_json.js:49:8)", " at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:106:20)", " at Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:78:10)", " at Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:686:14)", " at Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)", " at AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)", " at /var/task/node_modules/aws-sdk/lib/state_machine.js:26:10", " at Request. (/var/task/node_modules/aws-sdk/lib/request.js:38:9)", " at Request. (/var/task/node_modules/aws-sdk/lib/request.js:688:12)" ] }

{ "errorType": "ReferenceError", "errorMessage": "CUSTOMER is not defined", "stack": [ "ReferenceError: CUSTOMER is not defined", " at validateRecord (/var/task/index.js:72:57)", " at Runtime.exports.handler (/var/task/index.js:29:10)", " at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)" ] }

ahmedyounis commented 2 years ago

More Info: Hopefully we can get this issue resolved soon as its delaying the launch of our contact center.

Following this AWS blog exactly will provide a broken solution that allows only for the customer to send sms messages to the agent but the agent cannot reply.

Please fix. Much appreciated.

I contacted AWS Support regarding this issue, and this is what I received, I hope it helps: "After further analysis of the code that caused the error (/var/task/index.js:75:56) I observed that the variable “CUSTOMER” and “ALL” have not been instantiated and that line 72-74 are incorrect. I also could see that a similar issue was raised in this repository [4] and I have reached out to one of the engineers regarding this. Please note that as Premium Support, I do not have visibility into code changes and roadmaps and would thus not be able to provide you with an ETA on when a fix will be implemented. The best way would be to monitor the issue on the Github page."

References AWS Blog - sms-through-amazon-connect https://aws.amazon.com/blogs/contact-center/building-personalized-customer-experiences-over-sms-through-amazon-connect/ms-through-amazon-connect/

marutishanbhag commented 2 years ago

I had similar issue , and found that its related to the access resource in outboundMessageFunction.addToRolePolicy within lib> chat-message-streaming-examples-stack.ts file. Updated to below resolved the issue.

outboundMessageFunction.addToRolePolicy(
  new iam.PolicyStatement({
    actions: ['mobiletargeting:*'],
    effect: iam.Effect.ALLOW,
    resources: [
      '*',
    ],
  })
);