serverless/serverless · error · ServerlessError

DEPLOYMENT_BUCKET_NOT_FOUND

DEPLOYMENT_BUCKET_NOT_FOUND

Error message

Could not locate deployment bucket: "${this.bucketName}". Error: ${err.message}

What it means

Error "Could not locate deployment bucket: "${this.bucketName}". Error: ${err.message}" thrown in serverless/serverless.

Source

Thrown at packages/serverless/lib/plugins/aws/deploy/lib/ensure-valid-bucket-exists.js:35

        err.providerError?.code !== 'ValidationError' ||
        !err.message.includes('does not exist for stack')
      ) {
        throw err
      }
    }

    // Validate that custom deployment bucket exists and has proper location
    if (
      this.serverless.service.provider.deploymentBucket ||
      this.globalDeploymentBucketUsed
    ) {
      let result
      try {
        result = await this.provider.request('S3', 'getBucketLocation', {
          Bucket: this.bucketName,
        })
      } catch (err) {
        throw new ServerlessError(
          `Could not locate deployment bucket: "${this.bucketName}". Error: ${err.message}`,
          'DEPLOYMENT_BUCKET_NOT_FOUND',
        )
      }

      if (result.LocationConstraint == null || result.LocationConstraint === '')
        result.LocationConstraint = 'us-east-1'
      if (result.LocationConstraint === 'EU')
        result.LocationConstraint = 'eu-west-1'
      if (result.LocationConstraint !== this.provider.getRegion()) {
        throw new ServerlessError(
          'Deployment bucket is not in the same region as the lambda function',
          'DEPLOYMENT_BUCKET_INVALID_REGION',
        )
      }
      // If above is satisfied, then custom S3 bucket is valid
      return
    }

View on GitHub (pinned to b9d7ea51c8)

Solutions

  1. Verify the deployment bucket name and that it exists in your account, and grant s3:GetBucketLocation/HeadBucket permissions.

When it happens

Trigger: Thrown at packages/serverless/lib/plugins/aws/deploy/lib/ensure-valid-bucket-exists.js:35 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of serverless/serverless@b9d7ea51c8 (2026-08-13). Data as JSON: /api/errors/b9618eec7785d88f. Report an issue: GitHub.