SQS events are nil

Hello everyone,

I followed the direction on creating an SQS queue (described on this page: https://rubyonjets.com/docs/events/sqs/). It set up beautifully - very simple, quick! I used the “sqs_event :generate_queue” declaration.

Generating an event works fine, calls the Lambda method, but the event is NilClass.

What am I missing?

Theron W.

I thought this might have something to do with IAM permissions, but no luck.

I dug more deeply into Jets. The generated “handlers” folder which has the entry point to the Lambda is receiving the event just fine. So, it is working, but Jets is not delivering the event to my handler function.

Unsure. :face_with_monocle: Just tried this code:

class HardJob < ApplicationJob
  class_timeout 30 # must be less than or equal to the SQS queue default timeout
  sqs_event :generate_queue
  def lift
    puts "lift event #{JSON.dump(event)}"

Deployed it and sent a message to the queue and saw it in the logs:

2021-10-07 22:01:37 UTC 2021/10/07/[$LATEST]02ba90e647c54c08b07967573af6e765 START RequestId: dd30590a-0b8f-59a4-8c82-00d37bf33280 Version: $LATEST
2021-10-07 22:01:37 UTC 2021/10/07/[$LATEST]02ba90e647c54c08b07967573af6e765 lift event {"Records":[{"messageId":"ba0a2a15-2986-4f23-bf44-440443aa4ab4","receiptHandle":"AQEBVb6YfplY6KGZz0YPxLeDN6BIh9amj9ZABqeKNyTSAk412oEsLBmStR+0rmOJyCJruyBvlmLa4FZBDaRrmMj86TO165iruNc170XxrrVOHB+BGVtqJhc3hapRt4eGygeoveLn8exr7hFeqjeUYFwa0Kx/sk8IxOWp5+FVFJZnGxNAcgfSmdjg85qU3iF8L7BEAy7paLJeiPe7dI1A9xtMPLJidygrj7K89blbnQaV7LAoRmvLDrbZxxuhHclX3xcCqzNHnR8stoumzNrN/UxLs0GHO5GOtXfIgYUX0LWe2hR85AuEGN0YV6q2ot/qB/W5dTLa5BkdRWuqUBxqlnHJthD2kd3DDNCH73WheT0Iwd+tQ/c6I2N1L/YTfcsyWsROdxgN8hbYdYdXsj3vWAGqszC3zZrziXLrObnboVF9LYS70jQuVtPlUGwXDIQDxk7qYuMk3zEr5AyxylKf3x0lpQ==","body":"{\"test\": \"hello lift\"}","attributes":{"ApproximateReceiveCount":"1","SentTimestamp":"1633644094693","SenderId":"AIDAJTCD6O457Q7BMTLYM","ApproximateFirstReceiveTimestamp":"1633644094702"},"messageAttributes":{},"md5OfBody":"a4a4e288d7422585bc602f409a23cb55","eventSource":"aws:sqs","eventSourceARN":"arn:aws:sqs:us-west-2:536766270177:demo-dev-HardJob-1AKY9MCP5O35P-LiftSqsQueue-1CAH9LFQDUB0Y","awsRegion":"us-west-2"}]}
2021-10-07 22:01:37 UTC 2021/10/07/[$LATEST]02ba90e647c54c08b07967573af6e765 END RequestId: dd30590a-0b8f-59a4-8c82-00d37bf33280
2021-10-07 22:01:37 UTC 2021/10/07/[$LATEST]02ba90e647c54c08b07967573af6e765 REPORT RequestId: dd30590a-0b8f-59a4-8c82-00d37bf33280     Duration: 5.87 ms       Billed Duration: 6 ms   Memory Size: 1536 MB   Max Memory Used: 148 MB Init Duration: 2488.48 ms

Its a little bit hard to see but can see the message that I sent to the queue:

"body":"{\"test\": \"hello lift\"}"

So believe this feature is working. Hope that helps.

I copied and pasted your code exactly. My results:

> 2021-10-08T15:15:26.892-04:00	START RequestId: d7562317-5fde-5f1b-91b9-7acdc523bfe6 Version: $LATEST
> 2021-10-08T15:15:26.896-04:00	lift event null
> 2021-10-08T15:15:26.899-04:00	END RequestId: d7562317-5fde-5f1b-91b9-7acdc523bfe6
> 2021-10-08T15:15:26.899-04:00	REPORT RequestId: d7562317-5fde-5f1b-91b9-7acdc523bfe6 Duration: 5.44 ms Billed Duration: 6 ms Memory Size: 1536 MB Max Memory Used: 184 MB Init Duration: 3476.63 ms

I’m going to try in a different environment

Dang. A completely different environment produces the same results for me.