greghendershott / aws

Racket support for Amazon Web Services.
BSD 2-Clause "Simplified" License
78 stars 25 forks source link

SQS sometimes doesn't deliver the entire available message body #59

Closed wesleybits closed 6 years ago

wesleybits commented 6 years ago

Hi Greg,

It's me again.

I found something up with the SQS integration, where if you're trying to send a string of JSON or XML through in your message body, the XML parser will chop it up on quotes and other delimiters. It'll appear appear as though only the text up to the first delimiter, or that delimiter itself, was sent along.

It's easy to reproduce it. Just do this:

> (require xml aws/keys aws/sqs)
> (read-keys)
> (define q-uri (create-queue "TestXmlQueue"))
> (define payload (xexpr->string '(root (message "hello"))))
> (send-message q-uri payload)
;; wait a bit
> (receive-message q-uri)
(message "<" ...)

I know it's a list, because I rooted around in aws/sqs.rkt and inserted (log-debug "Message body: ~a" (se-path*/list '(Body) x)) right above this line. The log output confirms that the whole message is there, but se-path* only returns the first child (just the way it was documented :))

[debug] Message Body: (< root > < message > hello < /message > < /root >)

I did some further rooting around and sourced it to Racket's own XML reader. I've got a fork with a working work-around ready for your consideration. Since I don't know the going procedure for contributions to your project, I'll wait for your blessing before submitting a PR.

greghendershott commented 6 years ago

Hi! I glanced at your fork and yes -- I think using se-path*/list is the right thing to do. I'd be happy to merge a PR. (I will probably want squash the commits down to one before merging.) Thank you!

wesleybits commented 6 years ago

OK, sounds legit.