Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQS Exception: 404 Not Found on DeleteMessage #2

Closed
heathdutton opened this issue May 4, 2020 · 9 comments
Closed

SQS Exception: 404 Not Found on DeleteMessage #2

heathdutton opened this issue May 4, 2020 · 9 comments

Comments

@heathdutton
Copy link

heathdutton commented May 4, 2020

Thanks a ton for putting this repo out there. Can't wait to use it!

Using Laravel 7/latest.

I am not having any trouble inserting queued jobs, but the worker lambda function gets an error trying to use DeleteMessage. Looks like the prefix or account number is missing. I followed your handler.php script exactly. Feels like I'm missing something quite obvious.

EnvVars:

QUEUE_CONNECTION=sqs
SQS_QUEUE=queue-name
SQS_PREFIX=https://sqs.us-east-2.amazonaws.com/##########

Logs:

Invoke Error	{"errorType":"Aws\\Sqs\\Exception\\SqsException","errorMessage":"Error executing \"DeleteMessage\" on \"https:\/\/sqs.us-east-2.amazonaws.com\/queue-name\"; AWS HTTP error: Client error: `POST https:\/\/sqs.us-east-2.amazonaws.com\/queue-name` resulted in a `404 Not Found` response:\n<?xml version=\"1.0\"?><ErrorResponse xmlns=\"http:\/\/queue.amazonaws.com\/doc\/2012-11-05\/\"><Error><Type>Sender<\/Type><Code>I (truncated...)\n InvalidAddress (client): The address queue-name is not valid for this endpoint. - <?xml version=\"1.0\"?><ErrorResponse xmlns=\"http:\/\/queue.amazonaws.com\/doc\/2012-11-05\/\"><Error><Type>Sender<\/Type><Code>InvalidAddress<\/Code><Message>The address queue-name is not valid for this endpoint.<\/Message><Detail\/><\/Error><RequestId>f9c8c3e8-7f30-59cb-8e4f-94c22c91574c<\/RequestId><\/ErrorResponse>","stack":["#0 \/var\/task\/vendor\/aws\/aws-sdk-php\/src\/WrappedHttpHandler.php(97): Aws\\WrappedHttpHandler->parseError()","#1 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(203): Aws\\WrappedHttpHandler->Aws\\{closure}()","#2 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(174): GuzzleHttp\\Promise\\Promise::callHandler()","#3 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/RejectedPromise.php(40): GuzzleHttp\\Promise\\Promise::GuzzleHttp\\Promise\\{closure}()","#4 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/TaskQueue.php(47): GuzzleHttp\\Promise\\RejectedPromise::GuzzleHttp\\Promise\\{closure}()","#5 \/var\/task\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/CurlMultiHandler.php(119): GuzzleHttp\\Promise\\TaskQueue->run()","#6 \/var\/task\/vendor\/guzzlehttp\/guzzle\/src\/Handler\/CurlMultiHandler.php(146): GuzzleHttp\\Handler\\CurlMultiHandler->tick()","#7 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(246): GuzzleHttp\\Handler\\CurlMultiHandler->execute()","#8 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(223): GuzzleHttp\\Promise\\Promise->invokeWaitFn()","#9 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(267): GuzzleHttp\\Promise\\Promise->waitIfPending()","#10 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(225): GuzzleHttp\\Promise\\Promise->invokeWaitList()","#11 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(267): GuzzleHttp\\Promise\\Promise->waitIfPending()","#12 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(225): GuzzleHttp\\Promise\\Promise->invokeWaitList()","#13 \/var\/task\/vendor\/guzzlehttp\/promises\/src\/Promise.php(62): GuzzleHttp\\Promise\\Promise->waitIfPending()","#14 \/var\/task\/vendor\/aws\/aws-sdk-php\/src\/AwsClientTrait.php(58): GuzzleHttp\\Promise\\Promise->wait()","#15 \/var\/task\/vendor\/aws\/aws-sdk-php\/src\/AwsClientTrait.php(86): Aws\\AwsClient->execute()","#16 \/var\/task\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Jobs\/SqsJob.php(71): Aws\\AwsClient->__call()","#17 \/var\/task\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/CallQueuedHandler.php(66): Illuminate\\Queue\\Jobs\\SqsJob->delete()","#18 \/var\/task\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Jobs\/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()","#19 \/var\/task\/vendor\/bref\/laravel-bridge\/src\/Queue\/LaravelSqsHandler.php(87): Illuminate\\Queue\\Jobs\\Job->fire()","#20 \/var\/task\/vendor\/bref\/laravel-bridge\/src\/Queue\/LaravelSqsHandler.php(69): Bref\\LaravelBridge\\Queue\\LaravelSqsHandler->process()","#21 \/var\/task\/vendor\/bref\/bref\/src\/Event\/Sqs\/SqsHandler.php(18): Bref\\LaravelBridge\\Queue\\LaravelSqsHandler->handleSqs()","#22 \/var\/task\/vendor\/bref\/bref\/src\/Runtime\/LambdaRuntime.php(104): Bref\\Event\\Sqs\\SqsHandler->handle()","#23 \/opt\/bref\/bootstrap.php(38): Bref\\Runtime\\LambdaRuntime->processNextEvent()","#24 {main}"]}
@mnapoli
Copy link
Member

mnapoli commented May 4, 2020

Thanks for the report! I'll work on that tomorrow and post back.

@heathdutton
Copy link
Author

I think I may have figured it out. In handler.php I'm using:

return $app->makeWith(LaravelSqsHandler::class, [
    'connection' => 'sqs',
    'queue'      => getenv('SQS_PREFIX') . '/' . getenv('SQS_QUEUE'),
]);

@mnapoli
Copy link
Member

mnapoli commented May 5, 2020

@heathdutton I am sending you an email right now, I have more details for you about this project. Talk to you soon.

@fabiofdsantos
Copy link
Contributor

@mnapoli
I had the same issue and it required:
'queue' => getenv('SQS_PREFIX').'/'.getenv('SQS_QUEUE'),

Should we update documentation?

@mnapoli
Copy link
Member

mnapoli commented Oct 4, 2020

Isn't the documentation mentioning to put the full URL already?

image

@fabiofdsantos
Copy link
Contributor

Well, I guess that depends on the interpretation.
I used both SQS_PREFIX and SQS_QUEUE for Lumen, while worker.php example expects SQS_QUEUE to include also SQS_PREFIX.

@mnapoli
Copy link
Member

mnapoli commented Oct 5, 2020

👍 then maybe a note about this could help indeed.

@fabiofdsantos
Copy link
Contributor

Otherwise environment variables will have different meanings which can lead to potential issues in the future..
Btw, thanks for this amazing work!

@alexkb
Copy link

alexkb commented Jun 3, 2021

I agree with @fabiofdsantos laravel-bridge should be using the same environment variable meanings as Laravel/Lumen. That is, the SQS_PREFIX is the URL without the queue name and SQS_QUEUE is the queue name. Then this is more in line with the idea of having one connection with multiple queues and users coming over from the Laravel/Lumen server based world (trying serverless) will have less friction (as we've all had in this thread). All that's needed is an update to the README.md I think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants