Comcast / cmb

This project is no longer actively supported. It is made available as read-only. A highly available, horizontally scalable queuing and notification service compatible with AWS SQS and SNS
Apache License 2.0
277 stars 50 forks source link

queue missing from SQS HTTP Request's URL PATH #37

Closed oldshuren closed 9 years ago

oldshuren commented 9 years ago

I tried to use aws javascript sdk to talk to cmb's cqs server. I got AWS.SimpleQueueService.NonExistentQueue error. I traced the problem to that aws-sdk-js doesn't put the queue name in the HTTP Request URL path, instead it uses a QueueUrl parameter. Here is the HTTP request

POST / HTTP/1.1 User-Agent: aws-sdk-nodejs/2.1.8 darwin/v0.10.33 Content-Type: application/x-www-form-urlencoded; charset=utf-8 Content-Length: 178 Host: 135.104.238.162:6059 X-Amz-Date: 20150204T172109Z Authorization: AWS4-HMAC-SHA256 Credential=SMN034Y3U4IRY9ZV38IG/20150204/us-east-1/sqs/aws4_request, SignedHeaders=host;x-amz-date, Signature=b8391d89d3e11ab8db355764d67c6e8939dab9f00238c6dde1f37bafff2beba8 Connection: keep-alive

Action=ReceiveMessage&MaxNumberOfMessages=1&QueueUrl=http%3A%2F%2F135.104.238.162%3A6059%2F422904998956%2FTestQueue&Version=2012-11-05&VisibilityTimeout=30&WaitTimeSeconds=20

The aws-sdk-java uses different request, the queue info is in the PATH part of the request. such as

POST /422904998956/TestQueue HTTP/1.1 User-Agent: aws-sdk-nodejs/2.1.8 darwin/v0.10.33 Content-Type: application/x-www-form-urlencoded; charset=utf-8 Content-Length: 178 Host: 135.104.238.162:6059 X-Amz-Date: 20150204T172109Z Authorization: AWS4-HMAC-SHA256 Credential=SMN034Y3U4IRY9ZV38IG/20150204/us-east-1/sqs/aws4_request, SignedHeaders=host;x-amz-date, Signature=b8391d89d3e11ab8db355764d67c6e8939dab9f00238c6dde1f37bafff2beba8 Connection: keep-alive

Action=ReceiveMessage&MaxNumberOfMessages=1&Version=2012-11-05&VisibilityTimeout=30&WaitTimeSeconds=20

CQS handles the java request correctly.

I submitted a bug to aws-sdk-js, but the maintainer suggested that the queue info should be either in the URL path or as QueueUrl parameter. Many tools, such aws-sdk-js and CLI depend on this. He suggested I raise an issue here.

By the way, the error is raised in com/comcast/cqs/controller/CQSCache.java:71 function getCachedQueue(), it only checks the URL, not the parameters in the body.

boriwo commented 9 years ago

Thank you for tracking this down and for reporting the issue. Will try to address this in the next point release. Stay tuned for updates.

boriwo commented 9 years ago

Should work now if you get the latest code. Please give it a try. Would also be nice if you could provide your JS client code as a pull request for our examples folder. Thanks!