Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

bug: Error InvalidLocationConstraint when creating S3 bucket with aws-sdk-js #8000

@gsf4726

Description

@gsf4726

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Recently, the localstack/localstack:latest docker image started returning the following exception when attempting to create an S3 bucket.

The error goes away with the 1.4 tag. I notice that the latest tag is now reporting version 2.0.0, so I'm assuming the error started when switching latest to 2.0.0.

InvalidLocationConstraint: The specified location-constraint is not valid
    at Request.extractError (/app/node_modules/aws-sdk/lib/services/s3.js:711:35)
    at Request.callListeners (/app/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/app/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/app/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/app/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/app/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /app/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/app/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/app/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/app/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
    at Request.emit (/app/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/app/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/app/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/app/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /app/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/app/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/app/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/app/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
    at callNextListener (/app/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
    at IncomingMessage.onEnd (/app/node_modules/aws-sdk/lib/event_listeners.js:417:13)
    at IncomingMessage.emit (node:events:539:35)
    at IncomingMessage.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'InvalidLocationConstraint',
  region: null,
  time: 2023-03-29T11:19:28.112Z,
  requestId: 'I6RF1Q8RUYAVEOIJ273KFJ9ANXG6E49AP1KQXVRG4F7H5Z3QOFYZ',
  extendedRequestId: 'MzRISOwyjmnupI6RF1Q8RUYAVEOIJ273KFJ9ANXG6E49AP1KQXVRG4F7H5Z3QOFYZ7/JypPGXLh0OVFGcJaaO3KW/hRAqKOpIEEp',
  cfId: undefined,
  statusCode: 400,
  retryable: false,
  retryDelay: 6.0331350608730405,
  attemptNumber: 21,
  retriesLeft: 0
}

Expected Behavior

The S3 bucket is created successfully.

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)

  localstack:
    image: localstack/localstack
    ports:
      - "4566:4566"
      - "8081:8080"
    environment:
      - SERVICES=s3
      - DATA_DIR=/tmp/localstack/data
      - PORT_WEB_UI=8080
      - HOSTNAME=localstack
      - DOCKER_HOST=unix:///var/run/docker.sock

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

const AWS = require('aws-sdk');

const s3 = new AWS.S3({
  apiVersion: '2006-03-01',
  accessKeyId: 'test',
  secretAccessKey: 'test',
  s3ForcePathStyle: true,
  s3BucketEndpoint: false,
  endpoint: new AWS.Endpoint('http://localstack:4566'),
  sslEnabled: false
});

const params = { Bucket: bucket };

await s3.createBucket(params).promise();

Environment

- OS: OSX 13.2.1 (22D68)
- LocalStack: latest

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions