localstack / localstack/serverless-localstack

Serverless deploy to LocalStack fails: “Invalid character in header content [authorization]”

Open
#273 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
542
Forks
92
PR merge metrics
No merged PRs in 30d

Description

Running serverless deploy --stage local against LocalStack aborts during the “Resolving AWS account ID” step with the error:

Unable to find function cleanup on plugin Esbuild
Deploying "sls" to stage "local" (us-east-1)
Using serverless-localstack
Using serverless-localstack
serverless-localstack: Reconfigured endpoints

Error: Failed to resolve AWS account ID: Invalid character in header content ["authorization"]

deployment never reaches packaging or CloudFormation synthesis

serverless.ts

plugins: ['serverless-iam-roles-per-function', 'serverless-localstack'],

custom:
  localstack:
    stages: ['local']
    edgePort: 4566
    host: 'http://localhost'

provider:
  name: aws
  runtime: nodejs22.x
  environment:
    AWS_ENDPOINT_URL: 'http://localhost:4566'
    AWS_ACCESS_KEY_ID: '000000000001'
    AWS_ACCOUNT_ID: '000000000001'

docker-compose.yml

  s3mock:
    image: adobe/s3mock:latest
    environment:
      - retainFilesOnExit=true
      - root=root
    ports:
      - 9090:9090
    volumes:
      - ./uploadedFiles:/root

  localstack:
    container_name: localstack
    image: localstack/localstack
    ports:
      - 4566:4566
      - 4510-4559:4510-4559
    environment:
      - DEBUG=${DEBUG:-0}
      - SERVICES=lambda,sqs,sns
    volumes:
      - '${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack'
      - '/var/run/docker.sock:/var/run/docker.sock'

Versions

Component Version
Serverless Framework 4.14.3
serverless-localstack 1.3.1
LocalStack Docker image localstack/localstack:latest (pulled 2025-05-14)
Node.js 22.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce serverless deploy --stage local using serverless.ts and docker-compose.yml, focusing on the “Resolving AWS account ID” step and the authorization-header error. Check the listed Serverless Framework, serverless-localstack, LocalStack, and Node.js versions. Done means deployment proceeds beyond account resolution to packaging and CloudFormation synthesis without the invalid-header failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, node.js, typescript
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.