calavera / aws-lambda-events

Rust event types for AWS Lambda
MIT License
128 stars 55 forks source link

invalid type: null, expected struct ConnectQueue #122

Closed edulix closed 1 year ago

edulix commented 2 years ago

I'm getting this error in my AWS Lambda, being used in a AWS Connect Contact Flow:

invalid type: null, expected struct ConnectQueue

This happens during the deserialization of the LambdaEvent, whose function signature is:

async fn function_handler(event: LambdaEvent<ConnectEvent>) -> Result<Value, Error> {}

I don't know how can I log the event in this kind of error, to log the request, otherwise I would attach the request json. However it seems quite clear that the reason is that the LambdaEvent is getting a null queue attribute here https://github.com/LegNeato/aws-lambda-events/blob/master/aws_lambda_events/src/generated/connect.rs#L63 . I am not using any connect que in my AWS Connect Contact Flow, because it's entirely automated with no agents involved. I'm not sure if I'm doing that wrong, or it is just a bug.

I suggest:

  1. Please update the generated ConnectEvent to allow a null value in the queue attribute if it's a bug. Probably needs to be updated in the upstream go source.
  2. If it's not a bug and I'm doing something wrong.. what is it?
calavera commented 2 years ago

it looks like a bug. The best way to proceed is to extract that event type from the generated resources, like we've done with other resources, and make that field optional.

edulix commented 2 years ago

Thanks for the fast response @calavera ! I'll try to send you a PR with the fix.