Code Monkey home page Code Monkey logo

amazon-connect-message-streaming-examples's Issues

No call made to API GTW from my Facebook page (via Messenger)

Hi

There have been a couple of times that the message entered into a Facebook page (FB Messenger) has triggered a call to AWS API Gateway. The logs show it to me.

But, without my understanding why, 99.99% of the time, no call is made between Facebook and our API (AWS). How can I see what if something is wrong on the Facebook side? Any steps to follow to troubleshoot the whole thing ?

Thanks

Replies not sent to customer (FB Messenger); Error in Outbound Lambda

Hello,

I have just deployed the solution and I can get Messages sent to FB Messenger routed to agent as a Chat message.
However, any replies from customer are not received by the customer (Messeneger). I am seeing below error in the Outbound Lambda:

2022-06-22T12:03:26.597Z 4c4d48af-e6e3-42b6-b7cb-6459826c52e7 ERROR Invoke Error {
"errorType": "TypeError",
"errorMessage": "The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined",
"code": "ERR_INVALID_ARG_TYPE",
"stack": [
"TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined",
" at new NodeError (internal/errors.js:322:7)",
" at Hmac.update (internal/crypto/hash.js:84:11)",
" at sendMessage (/var/task/lib/handlers/facebook.js:39:66)",
" at Object.handler (/var/task/lib/handlers/facebook.js:29:16)",
" at processTicksAndRejections (internal/process/task_queues.js:95:5)",
" at async handleMessage (/var/task/index.js:101:7)",
" at async Runtime.exports.handler (/var/task/index.js:56:5)"
]
}

Any suggestions ?

Ensure we don't send customer messages back to the customer. seems to be handled incorrectly

1. CUSTOMER and ALL are undefined

In the following process, CUSTOMER and ALL are undefined.

((record.Sns.MessageAttributes.MessageVisibility == CUSTOMER ||
record.Sns.MessageAttributes.MessageVisibility == ALL) &&

Cloud Watch Logs

ERROR	Invoke Error 	{
    "errorType": "ReferenceError",
    "errorMessage": "CUSTOMER is not defined",
...
}

2. SNS payload type error

I have checked the Example SNS payload and it seems that record.Sns.MessageAttributes.MessageVisibility is not correct and
record.Sns.MessageAttributes.MessageVisibility.Value is correct.

3. I feel uncomfortable with the conditional expression. L72-L74

The following equation is

((record.Sns.MessageAttributes.MessageVisibility == CUSTOMER ||
record.Sns.MessageAttributes.MessageVisibility == ALL) &&
record.Sns.MessageAttributes.MessageVisibility != CUSTOMER)

equivalent to

 (record.Sns.MessageAttributes.MessageVisibility != CUSTOMER &&
  record.Sns.MessageAttributes.MessageVisibility == ALL)

Is the conditional expression correct?

lib/chat-message-streaming-examples-stack.ts:259:27 - error TS1109: Expression expected.

There seems to be an inadvertent change to the lib/chat-message-streaming-examples-stack.ts file.

node_modules/ts-node/src/index.ts:513
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
lib/chat-message-streaming-examples-stack.ts:259:27 - error TS1109: Expression expected.

259 arn:aws:s3:::${}/*,

The signature is not detected correctly because the type is incorrect.

The return value of fb.validateRequest(...) is a Promise, so await is required.
If there is no "await", the signature detection will always succeed. (if (!validRequest) will be determined to be false)

caller

const validRequest = fb.validateRequest(event);

callee

aws-cdk v1.135.0 breaking changes

The changes published to AWS CDK v1.135.0 are stopping the project from compiling. The reason is that the aws cdk dependencies in this project were specified as "^.1.121.0". Dependencies could be fixed by restricting the dependencies to "1.121.0" or the changes to the APIs affected need to be implemented:

https://github.com/aws/aws-cdk/releases/tag/v1.135.0

  • apigatewayv2-integrations: LambdaProxyIntegration and LambdaProxyIntegrationProps are now renamed to HttpLambdaIntegration and HttpLambdaIntegrationProps respectively. The new class accepts the lambda function handler directly in its constructor.

Errors in outbound lambda function

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)"
]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.