Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Queue representation in ConnectEvent.java #482

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonnysw
Copy link

@jonnysw jonnysw commented Jun 10, 2024

Issue #, if available:
NA

Description of changes:
At present, when trying to invoke a lambda that uses a ConnectEvent in its handler, it will fail with:

An error occurred during JSON parsing: java.lang.RuntimeException
java.lang.RuntimeException: An error occurred during JSON parsing
Caused by: java.io.UncheckedIOException: com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
 at [Source: (ByteArrayInputStream); line: 1, column: 581] (through reference chain: com.amazonaws.services.lambda.runtime.events.ConnectEvent["Details"]->com.amazonaws.services.lambda.runtime.events.ConnectEvent$Details["ContactData"]->com.amazonaws.services.lambda.runtime.events.ConnectEvent$ContactData["Queue"])

I am fixing the Event model so that it can be correctly deserialised.

AWS Connect defines the Queue as an object when invoking a lambda, not a string. The object contains ARN and Name (as well as Address and Type). See here for the full model:
https://docs.aws.amazon.com/connect/latest/adminguide/connect-lambda-functions.html

For reference, I have followed the model used by the Go implementation here: https://github.com/aws/aws-lambda-go/blame/main/events/connect.go

Target (OCI, Managed Runtime, both):
both

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

AWS Connect defines the Queue as an object, not a string. The object contains ARN and name (as well as address and type).

I am fixing the Event model so that it correctly deserialised.

For reference, I have followed the model used by the Go implementation here: https://github.com/aws/aws-lambda-go/blame/main/events/connect.go
@smirnoal
Copy link
Contributor

smirnoal commented Jun 18, 2024

@jonnysw
Copy link
Author

jonnysw commented Jun 19, 2024

Thanks for taking a look @smirnoal - apologies for missing the tests, I'd just opened that one file in the online editor and hadn't thought to check. I've updated accordingly now, appreciate if you could take another look.

@msailes
Copy link
Collaborator

msailes commented Jun 19, 2024

While we're changing the event, I think it would be wise to include all the changes to Queue.

            "Queue": {
                   "ARN": "arn:aws:connect:eu-west-2:111111111111:instance/cccccccc-bbbb-dddd-eeee-ffffffffffff/queue/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
                 "Name": "PasswordReset"
                "OutboundCallerId": {
                    "Address": "+12345678903",
                    "Type": "TELEPHONE_NUMBER"
                }
            },

@smirnoal
Copy link
Contributor

@jonnysw would you take a look at the failed test?

@jonnysw
Copy link
Author

jonnysw commented Aug 14, 2024

Hi @smirnoal my apologies, I've recently changed job and had forgotten about this. Will try to spend some time on it over the next week if I can.

@joysl
Copy link

joysl commented Nov 22, 2024

Hi Team,
Customer would like this to be fixed, please lmk if it's something I can help with to pass the CI flow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants