我最近在部署 AWS Amplify 的网站时遇到了问题。在看似成功的构建和部署过程之后,我的网站意外返回 HTTP 404 错误,表明找不到该页面。
观察结果和采取的步骤:
├ ○ /404 1.89 kB 111 kB
) 之外。并发症:
我不知道是什么原因导致了这个问题。这可能与应用程序内的路由配置有关,或者可能与域的 DNS 设置尚未正确传播有关?
寻求见解:
日志摘录:
... (previous build and deployment logs)
├ ○ /404 1.89 kB 111 kB
... (subsequent logs)
package.json
{
"name": "olmo",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"eslint:fix": "npx eslint \"src/**/*.{js,tsx,jsx,ts}\" --fix",
"lint:filenames": "find src -type f ! -name '*.js' ! -name '*.jsx' ! -name '*.ts' ! -name '*.tsx' ! -name '*.json' ! -name '*.md' ! -name '*.css' -exec echo 'Invalid file extension found:' '{}' ';'",
"prepare": "husky"
},
"husky": {
"hooks": {
"pre-commit": "npm run lint:filenames && npm run lint"
}
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"dependencies": {
"@aws-amplify/adapter-nextjs": "^1.0.27",
"@next/font": "13.2.4",
"aws-amplify": "^6.0.27",
"bing-translate-api": "^4.0.1",
"dotenv": "^16.4.5",
"formik": "^2.4.5",
"isotope-layout": "^3.0.6",
"openai": "^4.33.0",
"react": "18.2.0",
"react-countup": "^6.4.2",
"react-dom": "18.2.0",
"react-select": "^5.8.0",
"react-slick": "^0.29.0",
"react-visibility-sensor": "^5.1.1",
"slick-carousel": "^1.8.1",
"uuid": "^9.0.1",
"wowjs
": "^1.1.3",
"yup": "^1.4.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.4",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^9.0.11",
"next": "^14.1.4",
"prettier-eslint": "^16.3.0",
"prettier-eslint-cli": "^8.0.1"
}
}
amplify.yml
version: 0.3
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- "**/*"
cache:
paths:
- node_modules/**/*
查看:
你找到解决办法了吗?我也有同样的问题