aws-amplify / aws-amplify/amplify-hosting

AMPLIFY_DIFF_DEPLOY enabled causes new SSR branches to fail deployment

Open
#3,031 7 comments 0 reactions 0 assignees View on GitHub
bug environment-variables 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-hosting/blob/master/FAQ.md).
- [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 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

I can provide privately

### AWS Region

us-east-2

### Amplify Hosting feature

Deployments, SSR

### Describe the bug

We have been using Amplify for hosting our application for a while. The application is a NextJS SSR application. Amplify correctly classifies the application as such. We had multiple branches connected for continues deployment and everything works as expected. When I connect new branches, the deployment phase fails with the following error.

```
2022-10-07T20:03:59 [INFO]: Beginning deployment for application XXXXX, branch:XXXX, buildId 0000000001
2022-10-07T20:04:00 [INFO]: Cannot find any generated SSR resources to deploy. If you intend for your app to be SSR, please check your app Service Role permissions. Otherwise, please check out our docs on how to setup your app to be detected as SSG (https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html#deploy-nextjs-app)
2022-10-07T20:04:00 [ERROR]: {"code":"7","message":"No ssrResources.json file"}
```

The existing already connected branches all work as expected. I have looked at all the similar issues but none of them seem to be relevant or recent enough.

### Expected behavior

I expect the deployment to succeed given that the existing branches are deploying successfully.

### Reproduction steps

1. Create a new Github branch off of an existing branch that is already working in Amplify
2. Connect the branch to AWS amplify with the same backend environment
3. The deployment phase of the release fails.

### Build Settings

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

### Log output

```
# Put your logs below this line
2022-10-07T20:03:59 [INFO]: Beginning deployment for application XXXXX, branch:XXXXX, buildId 0000000001
2022-10-07T20:04:00 [INFO]: Cannot find any generated SSR resources to deploy. If you intend for your app to be SSR, please check your app Service Role permissions. Otherwise, please check out our docs on how to setup your app to be detected as SSG (https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html#deploy-nextjs-app)
2022-10-07T20:04:00 [ERROR]: {"code":"7","message":"No ssrResources.json file"}

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Amplify Hosting deployment logs and the provided build settings for the Next.js SSR app. Reproduce the failure by connecting a new branch with AMPLIFY_DIFF_DEPLOY enabled, then compare it with an existing working branch. Done means the new branch deploys successfully without the missing ssrResources.json error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, next.js
Domain
ci-cd, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.