aws-amplify / aws-amplify/amplify-hosting

[NextJS][ISR] intermittent 503 errors for ISR pages

Open
#2,175 15 comments 3 reactions 0 assignees View on GitHub
bug documentation ssr
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-console/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-console/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### App Id

dh2ndod2t9wbt

### Region

us-east-1

### Amplify Console feature

Custom builds, Performance

### Describe the bug

- SSR Lambda is configured with a 10 second timeout which is causing ISR routes to return back an intermittent 503 error based on cold starts, data fetching, etc.

### Expected behavior

- SSR Lambdas should be configured with a 30 second timeout, or allow for a configuration override

### Reproduction steps

1. Create a NextJS app with an ISR route that contains a few data fetching calls, fallback = "blocking"
2. Deploy to Amplify
3. Request ISR page that was no pre-rendered during the build
4. Notice 503

### Build Settings

```yaml
version: 1
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- .next/cache/**/*
```

### Additional information

I have to manually go into the console and change the timeout value from 10 to 30 between every deploy

Contributor guide

Open the contributing guide

Research direction

Start with the reproduction steps in the issue: deploy a NextJS app using an ISR route with fallback="blocking" and several data-fetching calls, then request a page not pre-rendered during the build. Investigate how Amplify configures the SSR Lambda timeout. Done means the timeout is configurable or defaults to 30 seconds and the ISR request no longer intermittently returns 503.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, nextjs
Domain
backend, cloud
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.