Commit e5db5e6
authored
fix: Pass complete SQS event to offline queue consumer (#1208)
Our current offline SQS event payload contains only the message body.
This is insufficient in applications where we need to inspect the
metadata of received messages, and leads to `TypeError` in the consumer
during testing.
This PR adds the missing fields to the event, trying to be relatively
accurate. For example, the source queue ARN includes the correct queue
name and AWS account ID. In terms of overall structure, an `SQSEvent`
type is helpfully provided in the `@types/aws-lambda` package, which
I've used to ensure our mocked event meets expectations.
Complete event samples can be found here for reference:
https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
Jira: [ENG-3437]
[ENG-3437]: https://comicrelief.atlassian.net/browse/ENG-34371 parent 5e70d50 commit e5db5e6
1 file changed
Lines changed: 37 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
226 | 229 | | |
227 | 230 | | |
228 | 231 | | |
| 232 | + | |
| 233 | + | |
229 | 234 | | |
230 | 235 | | |
231 | 236 | | |
| |||
241 | 246 | | |
242 | 247 | | |
243 | 248 | | |
244 | | - | |
| 249 | + | |
245 | 250 | | |
246 | 251 | | |
247 | 252 | | |
| |||
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
257 | | - | |
| 262 | + | |
258 | 263 | | |
259 | 264 | | |
260 | 265 | | |
| |||
487 | 492 | | |
488 | 493 | | |
489 | 494 | | |
490 | | - | |
| 495 | + | |
491 | 496 | | |
492 | 497 | | |
493 | 498 | | |
494 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
495 | 502 | | |
496 | | - | |
| 503 | + | |
497 | 504 | | |
498 | 505 | | |
499 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
500 | 520 | | |
501 | 521 | | |
502 | | - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
503 | 530 | | |
504 | 531 | | |
505 | | - | |
506 | | - | |
507 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
508 | 535 | | |
509 | 536 | | |
510 | 537 | | |
| |||
0 commit comments