localstack / localstack/serverless-localstack

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

未关闭
#273 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
542
派生
92
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 serverless.tsdocker-compose.yml 重现 serverless deploy --stage local,重点关注“Resolving AWS account ID”步骤和 authorization-header 错误。检查所列出的 Serverless Framework、serverless-localstack、LocalStack 和 Node.js 版本。完成的标准是部署过程越过账户解析,继续进行 packaging 和 CloudFormation synthesis,且不再出现 invalid-header 失败。

由索引模型根据 Issue 内容生成。

评估

技术栈
aws, docker, node.js, typescript
领域
cloud, devops
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。