aws-amplify / aws-amplify/amplify-hosting

High waiting for server response time when using next/image

Open
#3,734 8 comments 12 reactions 1 assignee Claimed by @Jay2113 View on GitHub
compute investigating usability
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

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

### App Id

d3akk1nl18rszx

### AWS Region

us-east-1

### Amplify Hosting feature

Not Applicable

### Frontend framework

Next.js

### Next.js version

13.5.1

### Next.js router

Pages Router

### Describe the bug

We are experiencing extended waiting times for server responses when utilizing next/image. This issue occurs sporadically, and I suspect it may be connected to the cold boot of the `next/image` lambda function. Consequently, our image loading performance has been severely impacted.

Here is an example of the issue:

![image](https://github.com/aws-amplify/amplify-hosting/assets/59548833/a32b291c-4830-441a-b39e-8052aa7fa6a4)

This image is only 15KB in size, yet it takes a full 6 seconds to download. It's worth noting that we are also using the `webp` format for our images.

### Expected behavior

Images should load as quickly as possible and not be delayed due to server response times.

### Reproduction steps

1. Create a next.js app
2. Import some static images using next/image
3. Deploy the app on Amplify
4. Evaluate the performance of image loading (observe the presence of cold booting for images).

### Build Settings

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.