Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Next.js app from AWS Amplify doesn't detect the framework #2415

Open
cloudhx opened this issue Jan 8, 2025 · 2 comments
Open

Creating Next.js app from AWS Amplify doesn't detect the framework #2415

cloudhx opened this issue Jan 8, 2025 · 2 comments
Labels
hosting Issue related to Amplify Hosting pending-community-response Issue is pending a response from the author or community question Question or confusion about some aspect of the product

Comments

@cloudhx
Copy link

cloudhx commented Jan 8, 2025

Environment information

n/a

Describe the bug

We have a Next.js v15 app deployed to vercel and it works well. Now we want to deploy the exactly same code to AWS Amplify instead. But when we tried to create new app, Amplify cannot detect the correct framework.

Below are screenshots taken while creating the app.
Screenshot 2025-01-08 at 15 13 38
Screenshot 2025-01-08 at 15 15 54
Screenshot 2025-01-08 at 15 16 08

And package.json under packages/ops2-web-app is as below

{
  "private": true,
  "scripts": {
    "build": "next build",
    "dev": "next dev --turbo",
    "start": "next start"
  },
  "dependencies": {
    "@heroicons/react": "^2.1.4",
    "@radix-ui/react-dropdown-menu": "^2.1.2",
    "@radix-ui/react-label": "^2.1.0",
    "@radix-ui/react-popover": "^1.1.2",
    "@radix-ui/react-select": "^2.1.2",
    "@radix-ui/react-slot": "^1.1.0",
    "@radix-ui/react-tooltip": "^1.1.6",
    "@tailwindcss/forms": "^0.5.7",
    "@vercel/postgres": "^0.8.0",
    "apexcharts": "^4.1.0",
    "autoprefixer": "10.4.19",
    "bcrypt": "^5.1.1",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "date-fns": "^3.6.0",
    "lucide-react": "^0.460.0",
    "next": "^15.0.0",
    "next-auth": "5.0.0-beta.19",
    "pg": "^8.13.1",
    "postcss": "8.4.38",
    "react": "^18.3.1",
    "react-apexcharts": "^1.6.0",
    "react-day-picker": "^8.10.1",
    "react-dom": "^18.3.1",
    "tailwind-merge": "^2.5.5",
    "tailwindcss": "3.4.4",
    "typescript": "5.5.2",
    "use-debounce": "^10.0.4",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@types/bcrypt": "^5.0.2",
    "@types/node": "20.14.8",
    "@types/pg": "^8.6.6",
    "tailwindcss-animate": "^1.0.7"
  }
}

Can anyone shred some light on what could be wrong here?

Thanks!

Reproduction steps

n/a

@cloudhx cloudhx added the pending-triage Incoming issues that need categorization label Jan 8, 2025
@ykethan ykethan added the hosting Issue related to Amplify Hosting label Jan 8, 2025
@Jay2113
Copy link

Jay2113 commented Jan 13, 2025

Hi @cloudhx 👋 , thanks for reaching out to us. Based on the information shared, the baseDirectory within the amplify.yml file is currently set to dist/packages/ops2-web-app/dist. For Next.js applications version 14 and above, the output directory should be configured to .next to support both Static Site Generation (SSG) and Server-Side Rendering (SSR): https://docs.aws.amazon.com/amplify/latest/userguide/deploy-nextjs-app.html#build-setting-detection-ssg-14.

@Jay2113 Jay2113 added question Question or confusion about some aspect of the product pending-community-response Issue is pending a response from the author or community and removed pending-triage Incoming issues that need categorization labels Jan 13, 2025
@cloudhx
Copy link
Author

cloudhx commented Jan 14, 2025

Hi @Jay2113 , thank you for your reply. I made changes following your guide, but it still doesn't seem right, no framework detected. I remembered I tried Amplify a while ago and it should be able to detect Next.js framework automatically. Here are the updated screenshots.
Screenshot 2025-01-14 at 11 47 44
Screenshot 2025-01-14 at 11 48 37

I started the build anyway and it failed with below logs.

2025-01-14T11:13:12.211Z [INFO]: # Cloning repository: [email protected]:xxxxxxx/swm-poc.git
2025-01-14T11:13:13.519Z [INFO]:
2025-01-14T11:13:13.520Z [INFO]: Cloning into 'swm-poc'...
2025-01-14T11:13:13.520Z [INFO]: # Checking for Git submodules at: /codebuild/output/src403436820/src/swm-poc/.gitmodules
2025-01-14T11:13:13.530Z [INFO]: # Retrieving environment cache...
2025-01-14T11:13:13.567Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2025-01-14T11:13:13.567Z [INFO]: ---- Setting Up SSM Secrets ----
2025-01-14T11:13:13.567Z [INFO]: SSM params {"Path":"/amplify/d5nfvtfn53pka/service-detection/","WithDecryption":true}
2025-01-14T11:13:13.659Z [WARNING]: !Failed to set up process.env.secrets
2025-01-14T11:13:14.277Z [INFO]: # No package override configuration found.
2025-01-14T11:13:14.280Z [INFO]: # Retrieving cache...
2025-01-14T11:13:14.308Z [INFO]: # Retrieved cache
2025-01-14T11:13:16.475Z [INFO]: BackendEnvironment name service-detection for app d5nfvtfn53pka is invalid
2025-01-14T11:13:16.583Z [INFO]: Random environment name mersey generated
2025-01-14T11:13:19.150Z [INFO]: ## Starting Backend Build
## Checking for associated backend environment...
## No backend environment association found, continuing...
2025-01-14T11:13:19.150Z [INFO]: ## Completed Backend Build
2025-01-14T11:13:19.153Z [INFO]: ## Starting Frontend Build
# Starting phase: preBuild
# Executing command: npm install
2025-01-14T11:13:55.156Z [WARNING]: npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
2025-01-14T11:13:55.435Z [WARNING]: npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
2025-01-14T11:13:55.672Z [WARNING]: npm WARN deprecated
2025-01-14T11:13:55.673Z [WARNING]: [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-01-14T11:13:55.673Z [WARNING]: npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-01-14T11:13:55.673Z [WARNING]: npm
2025-01-14T11:13:55.674Z [WARNING]: WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-01-14T11:13:55.677Z [WARNING]: npm WARN
2025-01-14T11:13:55.677Z [WARNING]: deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-01-14T11:13:55.733Z [WARNING]: npm WARN deprecated [email protected]: This package is no longer supported.
2025-01-14T11:13:55.917Z [WARNING]: npm WARN
2025-01-14T11:13:55.917Z [WARNING]: deprecated [email protected]: This package is no longer supported.
2025-01-14T11:13:56.234Z [WARNING]: npm WARN
2025-01-14T11:13:56.234Z [WARNING]: deprecated [email protected]: This package is no longer supported.
2025-01-14T11:14:17.014Z [INFO]: added 1054 packages, and audited 1071 packages in 46s
2025-01-14T11:14:17.019Z [INFO]: 114 packages are looking for funding
run `npm fund` for details
2025-01-14T11:14:17.071Z [INFO]: 15 vulnerabilities (5 low, 1 moderate, 9 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
2025-01-14T11:14:17.104Z [INFO]: # Completed phase: preBuild
# Starting phase: build
# Executing command: npx nx build ops2-web-app
2025-01-14T11:14:18.229Z [WARNING]: /bin/sh: line 1: hostname: command not found
2025-01-14T11:14:18.395Z [INFO]:
2025-01-14T11:14:18.395Z [INFO]: NX Nx Cloud: Workspace is unable to be authorized. Exiting run.
This workspace is more than three days old and is not connected. Workspaces must be connected within 3 days of creation. Claim your workspace at https://cloud.nx.app.
2025-01-14T11:14:18.410Z [ERROR]: !!! Build failed
2025-01-14T11:14:18.410Z [ERROR]: !!! Error: Command failed with exit code 1
2025-01-14T11:14:18.410Z [INFO]: # Starting environment caching...
2025-01-14T11:14:18.411Z [INFO]: # Environment caching completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hosting Issue related to Amplify Hosting pending-community-response Issue is pending a response from the author or community question Question or confusion about some aspect of the product
Projects
None yet
Development

No branches or pull requests

3 participants