aws-amplify / aws-amplify/amplify-hosting

[nextjs] Missing dependencies for SSR

Open
#3,419 9 comments 1 reaction 0 assignees View on GitHub
compute investigating question
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

dbbff8yaqbc49

### AWS Region

us-west-2

### Amplify Hosting feature

SSR

### Describe the bug

spectaql is installed in my package.json

Hosting compute logs indicate it is missing

### Expected behavior

Dependencies should work like dependencies.

### Reproduction steps

1. Create next.js app
2. Use spectaql

### Build Settings

```yaml
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- env | grep -e GQL_SUPERGRAPH_ROUTER -e AUTH0_BASE_URL -e AUTH0_ISSUER_BASE_URL -e AUTH0_AUDIENCE -e AUTH0_SECRET -e AUTH0_CLIENT_ID -e AUTH0_CLIENT_SECRET >> .env.production
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*

```

### Log output

```
# Put your logs below this line

Error: Cannot find module '/var/task/node_modules/spectaql/dist/spectaql/index'

```

### Additional information

No workarounds that I am aware of, would appreciate any help.

I have reviewed other somewhat similar issues, but they all seem like different edge cases as opposed to spectaql usage.

Also maybe relevant, we're using nextjs auth0 as well, but haven't gotten past spectaql to review if there are any issues:
` "@auth0/nextjs-auth0": "^2.2.1",`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Next.js deployment with spectaql in package.json, running npm ci and npm run build from the shown build settings. Inspect the Hosting compute logs and the generated .next output for why spectaql is unavailable at runtime. Done means the deployed SSR app can load spectaql without the Cannot find module error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, nextjs, nodejs
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.