Skip to content

SSR compute Lambda hangs for 28s on rapid page refresh #4085

@oopslab-ai

Description

@oopslab-ai

Environment information

System:
  OS: Windows 11 10.0.26200
  CPU: (16) x64 AMD Ryzen 9 6900HS Creator Edition
  Memory: 3.85 GB / 27.69 GB
Binaries:
  Node: 22.12.0 - C:\Program Files\nodejs\node.EXE
  Yarn: 4.1.1 - C:\Program Files\nodejs\yarn.CMD
  npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/ai-constructs: 1.5.3
  @aws-amplify/auth-construct: 1.8.1
  @aws-amplify/backend: 1.16.1
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: 1.7.1
  @aws-amplify/backend-cli: 1.7.2
  @aws-amplify/backend-data: 1.6.1
  @aws-amplify/backend-deployer: 2.1.1
  @aws-amplify/backend-function: 1.14.1
  @aws-amplify/backend-output-schemas: 1.6.0
  @aws-amplify/backend-output-storage: 1.3.1
  @aws-amplify/backend-secret: 1.4.0
  @aws-amplify/backend-storage: 1.4.1
  @aws-amplify/cli-core: 2.1.1
  @aws-amplify/client-config: 1.7.0
  @aws-amplify/data-construct: 1.16.1
  @aws-amplify/data-schema: 1.21.0
  @aws-amplify/deployed-backend-client: 1.7.0
  @aws-amplify/form-generator: 1.2.1
  @aws-amplify/model-generator: 1.2.0
  @aws-amplify/platform-core: 1.9.0
  @aws-amplify/plugin-types: 1.10.1
  @aws-amplify/sandbox: 2.1.2
  @aws-amplify/schema-generator: 1.4.0
  @aws-cdk/toolkit-lib: 0.3.2
  aws-amplify: 6.14.4
  aws-cdk-lib: 2.197.0
  typescript: 5.8.3
No AWS environment variables
No CDK environment variables

Describe the bug

Description

I have a Next.js 14 app hosted on Amplify Gen 2. When I spam refresh on any page (even pages marked force-static), the SSR compute Lambda occasionally hangs for the full 28-second timeout. The page itself loads fine for the user, but behind the scenes Lambda invocations are running for 28 seconds doing nothing, and I'm getting billed for it massively. Its a unique situation but still a concern.

This doesn't make sense because these are fully static pages with no server-side data fetching. They should just serve cached HTML.

Logs

Timestamp Log Stream (deployment) Message
2025-09-19T02:30:21.204Z main/2025/09/19/4855c741a2624a12b064400c971d27eb Request timed out - your application took too long to respond
2025-09-19T02:30:21.205Z main/2025/09/19/4855c741a2624a12b064400c971d27eb REPORT RequestId: d1e176bd Duration: 28002.96 ms Billed: 28003 ms Memory: 1024 MB Used: 162 MB
2025-09-19T02:30:21.205Z main/2025/09/18/914830b9a6444fcb9c0d9aa528e057b9 START RequestId: 94953088 Version: $LATEST
2025-09-19T02:30:21.206Z main/2025/09/18/914830b9a6444fcb9c0d9aa528e057b9 Starting request using compute deployment_id: 0000000024
2025-09-19T02:30:21.357Z main/2025/09/18/914830b9a6444fcb9c0d9aa528e057b9 REPORT RequestId: 94953088 Duration: 151.24 ms Billed: 152 ms Memory: 1024 MB Used: 158 MB
2025-09-19T02:30:22.099Z main/2025/09/18/914830b9a6444fcb9c0d9aa528e057b9 Request timed out - your application took too long to respond

Reproduction steps

  1. Deploy any Next.js 14 app on Amplify Gen 2 hosting
  2. Mark the home page with export const dynamic = 'force-static'
  3. Open the deployed URL and refresh rapidly (10-20 times in a row)
  4. Check CloudWatch logs under the SSR compute log group

You'll see most requests complete in ~20ms, but at least one will hang for the full 28s timeout and get billed for it. The page loads fine for the user, this is all happening behind the scenes in the compute Lambda.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions