Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: SQS SendMessage with AWS SDK for PHP returns 404. #9587

@sunaoka

Description

@sunaoka

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am trying to use SendMessage to SQS using AWS SDK for PHP, but an error occurs and I cannot deliver the message.

Expected Behavior

No response

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

version: "3.8"

services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
    image: localstack/localstack:2.3.2
    ports:
      - "127.0.0.1:4566:4566"            # LocalStack Gateway
      - "127.0.0.1:4510-4559:4510-4559"  # external services port range
    environment:
      - DEBUG=${DEBUG-}
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"
docker compose up -d

So, create an SQS queue (in a docker container).

awslocal sqs create-queue --queue-name localstack-queue

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

use Aws\Sqs\SqsClient;

$sqs = new SqsClient([
    'credentials' => [
        'key'    => 'local',
        'secret' => 'local'
    ],
    'region'      => 'ap-northeast-1',
    'version'     => 'latest',
    'endpoint' => 'http://localhost:4566',
]);

$sqs->sendMessage([
    'QueueUrl'   => 'http://localhost:4566/000000000000/localstack-queue',
    'MessageBody => 'hello',
]);

An error occurs:

Client error: `POST http://localhost:4566/000000000000/localstack-queue` resulted in a `404 Not Found` response:  
<UnknownOperationException/>

Environment

- OS: macOS 13.5.2
- LocalStack: 2.3.2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions