serverless / serverless/serverless

Function URLs get deleted (or won't get created) when provisioned capacity is set on Lambdas for AWS

Open
#12,387 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

Are you certain it's a bug?
  • Yes, it looks like a bug
Is the issue caused by a plugin?
  • It is not a plugin issue
Are you using the latest v3 release?
  • Yes, I'm using the latest v3 release
Is there an existing issue for this?
  • I have searched existing issues, it hasn't been reported yet
Issue description

A funny one. I was experimenting with adding provisioned capacity to the Lambda URL function. On deployment everything looks good:

endpoints:
  GET - https://xxx.execute-api.us-east-1.amazonaws.com/api/{proxy+}
  POST - https://xxx.execute-api.us-east-1.amazonaws.com/api/{proxy+}
  backendURL: https://xxx.lambda-url.us-east-1.on.aws/

However in the console there's no Lambda URL configured. In the Cloudformation stack I can see that the Lambda URL was deleted:

image

When I comment out provisioned capacity, the Lambda URL is then created.

Service configuration (serverless.yml) content
service: apis
frameworkVersion: '3'

provider:
  name: aws
  runtime: nodejs20.x
  architecture: arm64
  stage: ${env:BUILD_STAGE, 'development'}
  region: ${env:AWS_REGION, 'us-east-1'}
  timeout: 29
  role: ${ssm:/xxx/lambda_role_arn}
  deploymentBucket:
    name: ${ssm:/xxx/s3_serverless}
    serverSideEncryption: aws:kms
  httpApi:
    id: ${ssm:/xxx/api_gateway_rest_api_id}

functions:
  backendURL:
    name: backendURL
    handler: streaming.handler
    timeout: 120
    # provisionedConcurrency: 10
    environment:
      ACCOUNT_ID: ${ssm:/${self:custom.service}/${self:provider.stage}/account_id}
      ORIGIN: https://${ssm:/xxx/cloudfront_site_domain}
    url:
      authorizer: aws_iam
      invokeMode: RESPONSE_STREAM
      cors:
        allowedOrigins:
          - https://${ssm:/xxx/cloudfront_site_domain}
          - https://localhost:4000
        allowedHeaders:
          - Content-Type
          - Authorization
          - X-Amz-Date
          - X-Api-Key
          - X-Amz-Security-Token
          - x-amz-content-sha256
        allowedMethods:
          - '*'
        allowCredentials: true

package:
  individually: false
  exclude:
    - node_modules/**
  excludeDevDependencies: true

custom:
  service: xxx
  name: ${self:custom.service}-backendAPIs

  serverless-offline:
    noPrependStageInUrl: true
    noAuth: true
    ignoreJWTSignature: true

  webpack:
    webpackConfig: webpack.config.js
    includeModules:
      packagePath: './build/server/service/package.json'

plugins:
  - serverless-better-credentials
  - serverless-deployment-bucket
  - serverless-webpack
  - serverless-offline
Command name and used flags

N/A

Command output
Using deployment bucket 'xxx'

✔ Service deployed to stack xxx (190s)

endpoints:
  GET - https://xxxx.execute-api.us-east-1.amazonaws.com/api/{proxy+}
  POST - https://xxxx.execute-api.us-east-1.amazonaws.com/api/{proxy+}
  backendURL: https://xxxx.lambda-url.us-east-1.on.aws/
functions:
  backend: xxx-APIs (5.7 MB)
  backendURL: xxx-APIs_url (5.7 MB)

2 deprecations found: run 'serverless doctor' for more details

Need a faster logging experience than CloudWatch? Try our Dev Mode in Console: run "serverless dev"
Environment information
Framework Core: 3.38.0 (local)
Plugin: 7.2.0
SDK: 4.5.1

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

Start by reproducing the deployment with the shown provisionedConcurrency and url configuration, then trace the deployment path that handles those two Lambda settings. Done means the Lambda Function URL remains configured when provisioned capacity is enabled, while the existing URL behavior still works without it.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.